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

I am working on video conferencing with mediasoup demo but i am getting this error:

WebSocket connection to ‘wss://videocall.test.com:4443/?roomId=0vkdadle&peerId=xxd1ngtx’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Web application working on
https:/videocall.test.com:2015

Url running good but getting websocket error.

Please any one help me. how can i fix this error.

Thanks in advance.

1 Like

Did you search the forum and read the demo app README?

Yes, I have set the ssl certificate and port in config.js if any mistake please guid. Main url working fine but websocket url not working with wss://domain:port
Thanks,
Check this screenshot.

Self signed certificate, right? Please, use a valid one.

Yes it’s valid. In browser’s URL SSL working fine but problem with wss:// websocket can you please sort out this problem with websocket SSL problem. Thanks :blush:

The fact that it works for HTTPS in the browser’s URL does not mean that it will also work for WSS. I’ll repeat my question: is it a self-signed certificate?

Start chrome with the flag --ignore-certificate-errors (it will show you a warning when you start that it’s insecure) -> if it runs with that it is your certificate 100%.

Hello please check this link i have installed valid ssl.
https://online.thinkcepts.com:4443/?roomId=kjglztfk
but still showing handshake issue. Please guide me what the problem.
Thanks,

Hello, can you suggest me any command for ubuntu?

I’m a Windows user, sorry. In any case, your site also doesn’t work with this flag, so the most likely next culprit is your server. I’d check the nginx logs or whatever you are using for network access, my assumption is that you are blocking access to the websocket’s port.

We are also seeing the same issue even in march 2021, can any share what is the reason is…Is there a way to curl wss URL…

When I ran websocat wss://localhost:3000 it says

websocat: WebSocket SSL error: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1913: (self signed certificate)

I have seen the certs, they are expired as on 2018. Sad to note this demo code is not maintained.

websocat -k wss://localhost:3000 gives proper response (i.e ignoring cert errors) which means server is ok

Few things which worked for me are…(server was started in default mode i.e. without gstream)

  1. enter chrome://flags/ in your browser url and enable #allow-insecure-localhost
  2. Replaced serverside certs with self-signed which have valid date
  3. starting chrome as “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --ignore-certificate-errors
  4. testing websocket URL s with plugins

or

if response from the test is like this… then it works (in all it is client side browser not accepting self-signed certs only)

{“action”:“router-rtp-capabilities”,“routerRtpCapabilities”:{“codecs”:[{“kind”:“audio”,“mimeType”:“audio/opus”,“clockRate”:48000,“channels”:2,“rtcpFeedback”:[{“type”:“transport-cc”}],“preferredPayloadType”:100,“parameters”:{}},{“kind”:“video”,“mimeType”:“video/VP8”,“clockRate”:90000,“rtcpFeedback”:[{“type”:“nack”},{“type”:“nack”,“parameter”:“pli”},{“type”:“ccm”,“parameter”:“fir”},{“type”:“goog-remb”},{“type”:“transport-cc”}],“preferredPayloadType”:101,“parameters”:{“x-google-start-bitrate”:1000}},{“kind”:“video”,“mimeType”:“video/rtx”,“preferredPayloadType”:102,“clockRate”:90000,“rtcpFeedback”:[],“parameters”:{“apt”:101}},{“kind”:“video”,“mimeType”:“video/VP9”,“clockRate”:90000,“rtcpFeedback”:[{“type”:“nack”},{“type”:“nack”,“parameter”:“pli”},{“type”:“ccm”,“parameter”:“fir”},{“type”:“goog-remb”},{“type”:“transport-cc”}],“preferredPayloadType”:103,“parameters”:{“profile-id”:2,“x-google-start-bitrate”:1000}},{“kind”:“video”,“mimeType”:“video/rtx”,“preferredPayloadType”:104,“clockRate”:90000,“rtcpFeedback”:[],“parameters”:{“apt”:103}},{“kind”:“video”,“mimeType”:“video/H264”,“clockRate”:90000,“parameters”:{“packetization-mode”:1,“level-asymmetry-allowed”:1,“profile-level-id”:“4d0032”,“x-google-start-bitrate”:1000},“rtcpFeedback”:[{“type”:“nack”},{“type”:“nack”,“parameter”:“pli”},{“type”:“ccm”,“parameter”:“fir”},{“type”:“goog-remb”},{“type”:“transport-cc”}],“preferredPayloadType”:105},{“kind”:“video”,“mimeType”:“video/rtx”,“preferredPayloadType”:106,“clockRate”:90000,“rtcpFeedback”:[],“parameters”:{“apt”:105}}],“headerExtensions”:[{“kind”:“audio”,“uri”:“urn:ietf:params:rtp-hdrext:sdes:mid”,“preferredId”:1,“preferredEncrypt”:false,“direction”:“recvonly”},{“kind”:“video”,“uri”:“urn:ietf:params:rtp-hdrext:sdes:mid”,“preferredId”:1,“preferredEncrypt”:false,“direction”:“recvonly”},{“kind”:“video”,“uri”:“urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id”,“preferredId”:2,“preferredEncrypt”:false,“direction”:“recvonly”},{“kind”:“video”,“uri”:“urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id”,“preferredId”:3,“preferredEncrypt”:false,“direction”:“recvonly”},{“kind”:“audio”,“uri”:“http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",“preferredId”:4,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“video”,“uri”:“http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time”,“preferredId”:4,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“audio”,“uri”:“http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01”,“preferredId”:5,“preferredEncrypt”:false,“direction”:“recvonly”},{“kind”:“video”,“uri”:“http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01”,“preferredId”:5,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“video”,“uri”:“http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07”,“preferredId”:6,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“video”,“uri”:“urn:ietf:params:rtp-hdrext:framemarking”,“preferredId”:7,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“audio”,“uri”:“urn:ietf:params:rtp-hdrext:ssrc-audio-level”,“preferredId”:10,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“video”,“uri”:“urn:3gpp:video-orientation”,“preferredId”:11,“preferredEncrypt”:false,“direction”:“sendrecv”},{“kind”:“video”,“uri”:“urn:ietf:params:rtp-hdrext:toffset”,“preferredId”:12,“preferredEncrypt”:false,“direction”:“sendrecv”}],“fecMechanisms”:[]},“sessionId”:"1678d0d0-8d87-11eb-9257-7522cc2825e1”}

Also, the urls with localhost or 127.0.0.1 does not work, use in browser with IP address such which may 179.xx etc… at linux terminal use command ip address to know the real ip address