Connection to WebSocket with error ERR_SSL_PROTOCOL_ERROR

I configured Websocket on my real server and I use SSL on the real server. When I used the following code on my local host, websockets were fine.

ws://localhost:8080/server.php 

As soon as I moved the file to a live server, I changed the code to the following

 wss://IP:PORT/server.php 

I created a separate port for the web socket and is configured on the TCP IN and OUT firewall. However, I get the following error on the console

Connection to WebSocket for ............ failed: error in establishing connection: net :: ERR_SSL_PROTOCOL_ERROR

Can anyone suggest me some solutions to solve this problem.

+7
source share
1 answer

Basically, when you use wss , you just use WebWocket on top of SSL/TLS .

Meanwhile, using plain ws does not require specific configuration, wss does. Indeed, when opening a connection, you must create a secure connection using a valid SSL certificate .

If you have a missing or invalid certificate, the connection cannot be updated, so an error will occur when trying to start a connection.

Therefore, you cannot just switch from ws to wss , but you must also make the correct implementation.

You can find more details here , hope this helps!

0
source

All Articles