Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

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

Solution 3:

try to change the port to 8080

const ws = new WebSocket('ws://localhost:8080/chat')

Solution 4:

Port 9090 is used by reactotron. Probably you are using it in your project and your app cannot connect with reactotron because it is closed. Just open reactotron and the error will disappear.

Solution 5:

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. Provide a valid TLS/SSL certificate and also configure it correctly in project, then it will work without the above error.

Post a Comment for "Websocket Connection Failed: Error In Connection Establishment: Net::err_connection_refused"