Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

I am new to WebRTC and WebSockets and was following this tutorial to create a WebRTC demo project, but I am unable to create a WebSocket connection. I have followed the same steps as mentioned in the project. His project is running on port 8080 and he mentioned ws://localhost:9090. My project is running on port 8081, but I copied his URL ws://localhost:9090 because I didn't know the significance of 9090 and I received this error and my server is node.js. i changed local host to 8081 as well but then i am getting hand shake error.

WebSocket connection to 'ws://localhost:9090/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED.

like image 793
Hafsa Avatar asked Jun 15 '17 19:06

Hafsa


People also ask

What causes WebSocket connection error?

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.

How do I enable WebSocket connection?

- In Control Panel, click Programs and Features, and then click Turn Windows features on or off. Expand Internet Information Services, expand World Wide Web Services, expand Application Development Features, and then select WebSocket Protocol. Click OK. Click Close.

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.

Why does WebSocket connection to'WS://localhost 9090/'fail?

WebSocket connection to 'ws://localhost:9090/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED. Show activity on this post. Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server).

What is err_connection_refused error?

A rejected connection message may appear regardless of the operating system used. You can therefore encounter an ERR_CONNECTION_REFUSED error message on Windows 10, as well as on a Mac. Android users can also be confronted with the connection problem if they use Chrome.

Why can't I connect to WebRTC?

Usually WebRTC requires a secure connection (that is https). The error you have got is due to TLS/SSL certificates occupied, may be they are not properly configured in your project.

Why am I getting a refused message from the server?

However the refused message is likely a server side problem, (usually port closed). Firstly, I would try a non-secure websocket connection. So remove one of the s 's from the connection address:


2 Answers

Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server). However the same should work fine with Firefox.

like image 150
Istvan Avatar answered Sep 18 '22 16:09

Istvan


You need to use ws://yourIp:9090/, where yourIP is like 192.168.?.?.

like image 40
Ashot Arzumanyan Avatar answered Sep 19 '22 16:09

Ashot Arzumanyan