lundi 11 mars 2019

WebSocket connection to 'wss://muDomain:8090/' failed: Error in connection establishment (only occur over wss)

Before applying ssl(I take from cloudflare) my website is loaded over http and my socket connection is made over ws

conn = new WebSocket('ws://myDomain:8090');

But after applying ssl when my website loads over https the I use wss (otherwise it give error)

conn = new WebSocket('wss://myDomain:8090');

Now it gives me the error

WebSocket connection to 'wss://myDomain:8090/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

The websocket server is started over 8090 port I also change the port to 9991 but to no avail.

Here is the code for websocket server

public function handle()
{
    $server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new WebSocketController()
            )
        ),
        8090
    );
    $server->run();
}

I requested you to give a clear solution to solve this. I read about to use nginx but I don't know how to properly configure it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire