Reputation: 239
I have configured the Websocket on my live server and I'm using SSL on live server. When I used following code on my localhost, websockets were fine.
ws://localhost:8080/server.php
Once I moved the file to the live server I have changed the code to the following
wss://IP:PORT/server.php
I have created a seperate port for web socket and configured on firewall TCP IN and OUT. However, I'm receiving the following error on console
WebSocket connection to ............ failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
Can anyone suggest me some solutions to overcome this issue
Upvotes: 18
Views: 45540
Reputation: 2209
here is what I did, I never able to install ssl in local, so I started using the w3cwebsocket client
and test it in console using
node index.js
var W3CWebSocket = require('websocket').w3cwebsocket; var client = new W3CWebSocket('wss://127.0.0.1:7000/'); console.log(client)
Upvotes: 1
Reputation: 14896
Basically when you are using wss
you are just serving the WebWocket
over SSL/TLS
.
Meanwhile using a simple ws
does not require a particular setup, wss
does. Indeed you have to create a secure connection using a valid SSL Certificate when opening the communication.
If you certificate is missing
or invalid
the connection cannot be enstabilished therefore an error will be raised while attempting to start the communication.
So you can't just switch from ws
to wss
but also have to make a proper implementation.
You can find more details here, hope that helps!
Upvotes: 13