Search code examples
phpwebsocketratchet

Ratchet IO Server suddenly stop working


I am using Ratchet Server. I am running it using cron job. My Chat application is working fine. But after sometime Rachet stop working. When I recheck whether the process is running or not, I can see the process is still there, but the Ratchet server basically could not be connected to anymore.

Here is my code which running server:

$server = IoServer::factory(
new HttpServer(
    new WsServer(
        new AppServer()
    )
),
8082);
$server->run();

I database connection fails at some point which stops the server. Any possible solution of this?


Solution

  • You can install Supervisord service in your Web Server which actually watch your Rachet Server, If your Rachet Server stopped it will automatically start it again.

    You can get Supervisord installation details from here.