Websocket handshake over SSL TIMEOUT

618 views Asked by At

I have my website running on shared hosting over https(Using Let's Encrypt). It implements websocket using Ratchet as below

$pusher = new qApp\Pusher;

 $loop   = React\EventLoop\Factory::create();
// Listen for the web server to make a ZeroMQ push after an ajax request
    $context = new React\ZMQ\Context($loop);
    $pull = $context->getSocket(ZMQ::SOCKET_PULL);
    $pull->bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
    $pull->on('message', array($pusher, 'onNewCall'));

$webSock = new React\Socket\Server('0.0.0.0:1234', $loop); // Binding to 0.0.0.0 means remotes can connect
    $webServer = new Ratchet\Server\IoServer(
        new Ratchet\Http\HttpServer(
            new Ratchet\WebSocket\WsServer(
                    $pusher
            )
        ),
        $webSock
    );

    $loop->run(); 

When client tried connecting

 var socket  = new WebSocket('ws://localhost:1234');

on localhost , it works fine.

But when same is tried on web server using wss

 var socket  = new WebSocket('wss://domainname.com:1234');

It TIMEOUTS after 15-20 secs . Is there anything i am missing in implementing.

0

There are 0 answers