Home / Ratchet WSS Websocket Error: Let's make it work!

Ratchet WSS Websocket Error: Let's make it work!

For those who are using Ratchet and encountered these errors using "wss" protocol, here is the easiest fix!

Before we start, just make sure that you enable these modules on your Apache configuration (httpd.conf)

LoadModule proxy_module modules/
LoadModule proxy_http_module modules/
LoadModule proxy_wstunnel_module modules/
LoadModule ssl_module modules/

# Put this line on your Apache's httpd.conf
ProxyRequests off
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPass /wss2/ ws://
# End of line

Then restart your Apache.


Now on your ratchet php file change the port to "8080"


$server = IoServer::factory(new HttpServer(new WsServer(new Chat)), 8080);

btw, you can use any port as long as it is not being used by other application

On your Javascript file, do something like this

var conn = new WebSocket('wss://');

Then run your Ratchet php file.

It should work now! :)