Search code examples
javascriptphpws

Web-sockets doesnt work after uploading files on hosting


Why isn't the web socket working? I use Workerman. I did a chat on a local server, everything worked fine there, however, when uploading to a remote server, an error began to appear in infothe console: WebSocket is already in CLOSING or CLOSED state. I thought it was because I was using ws and on the server I had https. I added the certificates (ssl-certificate - .pem; private-key - .key) however it also kept throwing this error. What happened, maybe it's in the server? I'm using PHP CLI 5.4.code jsphp codessl

UPD. I asked my hosting to reinstall ssl, after connecting it I get this error: SSL handshake error: stream_socket_enable_crypto(): SSL: Success

UPD2. it started working, but the connection is immediately disconnectedscretnshot


Solution

  • It probably requires a valid ssl certificate and not a self-signed one. You can try letsencrypt and use the nginx proxy.