ws icon indicating copy to clipboard operation
ws copied to clipboard

wss: Error during WebSocket handshake: Unexpected response code: 200

Open Ratismal opened this issue 9 years ago • 32 comments

Salutations,

I'm running a WebSocket server using this module, but am having issues connecting with certain browsers. The server is served through ssl, so I connect to it using wss.

The Issue

When I connect to the website using Google Chrome, everything works as intended. However, when I try to connect using Chromium, I get the following error:

WebSocket connection to 'wss://domain.name/' failed: Error during WebSocket handshake: Unexpected response code: 200

It should be noted that the client connects perfectly fine on my test instance, connecting to ws://localhost:8085. This seems to be an issue only with wss protocols. Obviously, using ws protocols over an ssl connection is not a viable option.

I have tried directly connecting via IP and port, but get the following error:

WebSocket connection to 'wss://ip.addr.he.re:8190/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED

My Code

Server:

const WebSocketServer = require('ws').Server;
const wss = new WebSocketServer({
    server: server // express server object, running on port 8085
  //port: 8190 // used when testing direct connections
});

Browser:

var wss = new WebSocket("wss://domain.name");

Sidenotes

I suspect this issue is due to chromium's websocket support itself. I noticed that there is client support available. Is there a browserified version of this module available for me to load via a

Owner


Other Repo Issues