Websockets not working


Hello, for some reason websockets (on Windows, Meteor 1.2 and 1.3 - upgrading didn’t fix) quit working with this error.

WebSocket connection to 'ws://localhost:3000/sockjs/472/_jiysdjk/websocket' failed: Error during WebSocket handshake: Invalid status line.

So I look to see what is going on in the websocket connection in the Chrome network tools and there is only one line:

(Opcode -1)

The app uses XHR now.

Any idea what’s going on?

Note: this started happening a while ago so if there’s any way I could avoid having to uninstall all packages that would be great. I guess I could just commit my files though, then remove packages one by one if need be.

Update - I searched the github repo - the word ‘opcode’ isn’t in a single place there! that makes me really wonder what’s happening.


Extract the ws:// URL from the error message, replace ws:// with http:// and paste it in a following command:

curl -vv -H 'Connection: Upgrade'  -H 'Upgrade: websocket' PASTE_HERE

For example:

curl -vv -H 'Connection: Upgrade'  -H 'Upgrade: websocket' http://localhost:3000/sockjs/411/vazi0idf/websocket

The correct response for that should be:

< HTTP/1.1 101 Switching Protocols
< upgrade: WebSocket
< connection: Upgrade
< websocket-location: ws://localhost:3000/sockjs/411/vazi0idf/websocket

Notice that the response status code was 101. Check what yours is saying, that may give you a hint about what’s wrong.


I get this error:

Could not resolve host: Upgrade' No data record of requested type Closing Connection #0


You probably misspelled something, or are missing a single quote in your command.


This is what I ran

curl -vv -H 'Connection: Upgrade' -H 'Upgrade: websocket' http://mo.localhost:3000/sockjs/747/9hc2onmc/websocket

I am running on a windows box


Ah, with Windows you probably need to use double quotes instead:

curl -vv -H "Connection: Upgrade" -H "Upgrade: websocket" http://mo.localhost:3000/sockjs/747/9hc2onmc/websocket


I keep getting a plain old timeout now.


Hey can you please have a look at the issue I raised.
I am stuck at creating a proxy to wss connection while handling ssl through nginx
Please find the link below