Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSocket connection to failed ERR_SSL_PROTOCOL_ERROR

Tags:

ssl

websocket

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

like image 589
user3818758 Avatar asked Jan 14 '16 19:01

user3818758


People also ask

How do I fix WebSocket connection failed?

Solution 1Check that all the Bot Insight services are running. Check that your firewall settings are configured to accept incoming websocket data. Try to use a different web browser. Restart the Bot Insight Visualization and Bot Insight Scheduler services.

What causes a WebSocket to fail?

The most common cause of Websocket error is when you connect to DSS through a proxy. Websockets is a fairly recent protocol and many enterprise proxies do not support it. The websocket connection will not establish and you will see this message.

Does WebSocket require SSL?

The probe supports Secure Sockets Layer (SSL) connections between the probe and WebSocket. SSL connections provide additional security when the probe retrieves alarms from the target systems. To enable SSL connections, obtain any required SSL certificates and Trusted Authority certificates for WebSocket.

What does WebSocket error mean?

A WebSocket error indicates a problem with the connection between your Ledger device and the Ledger Live application. Some users have reported facing this error message by using Ledger Live in places with restricted internet access.


2 Answers

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!

like image 88
Sid Avatar answered Sep 21 '22 19:09

Sid


here is what I did, I never able to install ssl in local, so I started using the w3cwebsocket client

https://www.npmjs.com/package/websocket

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)

like image 23
Code Tree Avatar answered Sep 21 '22 19:09

Code Tree