ratchet

Rachet chat application - connection closed immediately after established when the app runs for a period of time

自作多情 提交于 2019-12-07 11:26:20
We're using Laravel 4 together with Ratchet to create a chat application. Everything runs normally for about 14-20 hours. After a period of time the chat app stops to run. The connection gets established from the client to the server but right after that the server closes the connection. No errors get reported in our log files and the fact that we haven't been able to replicate the problem in our development environment doesn't help. Restarting the chat application on the server fixes the issue for another 14-20 hours. Supervisor configuration: [program:chat] command = bash -c "ulimit -n 10000

What is the best way to use websockets along with PHP and MySQL scripts? [closed]

亡梦爱人 提交于 2019-12-06 08:27:42
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What is the best way to use websockets along with PHP and MySQL scripts? If I want to add a live chat to my PHP site, or store vars to the MySQL database when doing X action in real time (for a RPG website trading, for example). I have found Ratchet , it's a good choice to achieve those things efficiently? Maybe using Node.js and PHP at the same time? I'm not sure what to do. I had the same question a few months

How to run Ratchet remotely or on a server?

懵懂的女人 提交于 2019-12-06 06:57:44
问题 Everything works fine on my local machine on XAMPP. But after I uploaded the files to a server, it gives a error like this... Fatal error: Uncaught exception 'React\Socket\ConnectionException' with message 'Could not bind to tcp://0.0.0.0:8080: Address already in use' in /home/sites/jemaottest.com/public_html/websocket/vendor/react/socket/src/Server.php:29 Stack trace: #0 /home/sites/jemaottest.com/public_html/websocket/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(70): React\Socket

Ratchet Store Connection of User & Send Message Outside of Server Instance

烈酒焚心 提交于 2019-12-05 18:26:14
I have been following along with the tutorials here and got the ratchet server working. My chat class is the same as the tutorial more or less at the moment, so no point in showing that here yet since my question is more about implementation strategy . In the question I attached the user was looking how to get the connection object of a specific user. In the top answer solution keeping track of the resource IDs seems to be the way to do this. For example when the connection is created there is this code. public function onOpen(ConnectionInterface $conn) { // Store the new connection to send

How do I access the ratchet php periodic loop and client sending inside app?

主宰稳场 提交于 2019-12-05 17:13:58
问题 I have a Ratchet server and chat app class which runs fine. My problem is how do I add a periodic loop? I tried to follow the example in Periodically sending mesages to clients in Ratchet But I have been getting nowhere. My goal like this guy, is for the server to check all clients are still alive. Everytime I try to use the addPeriodicTimer, I cant seem to access the $clients public property in chat.php like the guy from the link above could in order to send messages from the timer in server

PHP Websocket authenticate user in a test (pass session cookie)

僤鯓⒐⒋嵵緔 提交于 2019-12-05 11:22:58
问题 I am trying to test a scenario, that on the one hand, anonymous users should immediately get a disconnect from a Websocket connection and on the other hand, authenticated users should stay in the websocket connection. The first case is easy testable by using the code down under. The authentication process is not working. For session storage, I am using Cookie authentication in combination with a database: Symfony PDO Session Storage. It's all working fine, but when it comes to testing the

How to attach a Symfony Session with the connection object from Ratchet?

冷暖自知 提交于 2019-12-05 05:02:00
问题 Hi I am working in a symfony real time app using Ratchet Library, In my app I need to send some data to a specific user.And the only way to do this is to attach a symfony session object to each incoming Connection object. I have read the doc here but I can't understand it and how to make it work in symfony? 回答1: As the documentation states need to setup a non-native session handler to store your sessions i.e. in a database via PDO. Then you need to configure Ratchet to use your session

PHP Ratchet: Class Memcache not found

落花浮王杯 提交于 2019-12-05 03:46:23
I am following Ratchet's tutorials. For SessionProvider page, the code is like this: <?php // Your shell script use Ratchet\Session\SessionProvider; use Symfony\Component\HttpFoundation\Session\Storage\Handler; use Ratchet\App; $memcache = new Memcache; // Class not found on line 7 $memcache->connect('localhost', 11211); $session = new SessionProvider( new MyApp , new Handler\MemcacheSessionHandler($memcache) ); $server = new App('localhost'); $server->route('/sessDemo', $session); $server->run(); PHP throws a fatal error when I run the script in the command-line : Class Memcache not found in

Access extra parameters in Ratchet web socket requests

你。 提交于 2019-12-04 18:21:55
问题 I've set up Ratchet for websockets in PHP . It is connecting fine from my javascript client using (ws://localhost:8080) and successfully send/receive messages. But I want to pass some params like (ws://localhost:8080?param1=value). I'm not able to figure out how can I access param1 in my PHP script . If possible in MessageComponentInterface::onOpen(ConnectionInterface $conn) method. Or better: Can I associate those params with ConnectionInterface $conn. So that I've them for further

How to run Ratchet remotely or on a server?

◇◆丶佛笑我妖孽 提交于 2019-12-04 14:11:12
Everything works fine on my local machine on XAMPP. But after I uploaded the files to a server, it gives a error like this... Fatal error: Uncaught exception 'React\Socket\ConnectionException' with message 'Could not bind to tcp://0.0.0.0:8080: Address already in use' in /home/sites/jemaottest.com/public_html/websocket/vendor/react/socket/src/Server.php:29 Stack trace: #0 /home/sites/jemaottest.com/public_html/websocket/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(70): React\Socket\Server->listen(8080, '0.0.0.0') #1 /home/sites/jemaottest.com/public_html/websocket/bin/chat-server.php