Search code examples
phpwebsocket

PHP web socket not connect in SSL


I am trying to connect PHP web socket using WSS.

  • took code reference from below link

https://github.com/sanwebe/Chat-Using-WebSocket-and-PHP-Socket

  • it shows error as below

WebSocket connection to 'wss://php.fmv.cc:12345/' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR

  • server configuration as below

enter image description here

enter image description here

  • these are the links on which I am trying

http://php.fmv.cc/c2.php (ws)

https://php.fmv.cc/c3.php (wss)

this will try to connect socket at : ws://php.fmv.cc:12345/ and wss://php.fmv.cc:12345/

Thank you...


Solution

  • Hello On the server configuration make setting like below

    ProxyPass /wss/ ws://127.0.0.1:12345/
    ProxyPassReverse /wss/ ws://127.0.0.1:12345/
    

    and on client side you can connect it using your domain don't mentioned port with it.

    use like wss://php.fmv.cc/wss