ratchet_client
ratchet_client copied to clipboard
WSS support
How many beers do I need to buy you for wss support?
Hi @TravisCornelius
The lib actually supports WSS, you juste have to configure reverse proxy on your apache or nginx server
Thanks
Hi, what exactly can I explain about using https and wss?
I can't use wss
I have the valid certificate on the host location I'm running ratchet with the host configuration tls: //0.0.0.0 but I have this javascript error message
"WebSocket connection to 'wss://0.0.0.0:8080/' failed: Error in connection establishment: net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH"
Thanks in advance for your help
If you want to use the current lib with WSS, you have to use a reverse proxy to tunnel the wss connection to ws, like e.g. here.
The included React and Ratchet libraries however do support WSS, so you only have to adjust the run() method of the Ratchet_client class to something like this:
$app = new \Ratchet\Http\HttpServer(
new \Ratchet\WebSocket\WsServer(
new Server()
)
);
$loop = \React\EventLoop\Factory::create();
$secure_websockets = new \React\Socket\Server($this->host . ':' . $this->port, $loop);
$secure_websockets = new \React\Socket\SecureServer($secure_websockets, $loop, [
'local_cert' => '/path/to/server.crt',
'local_pk' => '/path/to/server.key',
'allow_self_signed' => TRUE, // allow self signed certs, should be false in production
'verify_peer' => FALSE
]);
$secure_websockets_server = new \Ratchet\Server\IoServer($app, $secure_websockets, $loop);
$secure_websockets_server->run();