0

This is a maddening problem I come across once or twice every few months: websockets aren't working right. Here's the facts:

  1. My browser can connect to my local (loopback) server, but when the browser sends messages, the server never gets them.
  2. This has happened a few times to me before in the last 6 months - it always seems to start working without any change on my end, and for no apparent reason
  3. This started happening right after I restarted my computer...
  4. http://www.websocket.org/echo.html also doesn't work
    • The connection is being closed with code 1006, wasClean is false, and reason is a blank string
  5. Firefox and chrome both have this problem
  6. I've confirmed that turning off my firewall (windows 7) doesn't change anything
  7. I've also confirmed that a node.js client and server works on linux (centos 6 VM running inside my windows machine), but the same client and server setup doesn't work on my windows machine (tho when I tested on a different windows 7 machine, it works fine)

Here's the info from chrome's network tab:

Request URL:ws://echo.websocket.org/?encoding=text
Request Method:GET
Status Code:101 Web Socket Protocol Handshake

Request Headers CAUTION: Provisional headers are shown.
Cache-Control:no-cache
Connection:Upgrade
Cookie:__utma=9925811.1690403310.1402691326.1402691326.1402691326.1; __utmb=9925811.13.10.1402691326; __utmc=9925811; __utmz=9925811.1402691326.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)
Host:echo.websocket.org
Origin:http://www.websocket.org
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
Sec-WebSocket-Key:eH9OcxKQ/I6S+IkzY+HsaA==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
Query String Parametersview sourceview URL encoded
encoding:text

Response Headers
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:x-websocket-protocol
Access-Control-Allow-Headers:x-websocket-version
Access-Control-Allow-Headers:x-websocket-extensions
Access-Control-Allow-Headers:authorization
Access-Control-Allow-Headers:content-type
Access-Control-Allow-Origin:http://www.websocket.org
Connection:Upgrade
Date:Fri, 13 Jun 2014 21:36:59 GMT
Sec-WebSocket-Accept:d0eOTUUxMpkKsI6x9RJ+vGBxl3w=
Server:Kaazing Gateway
Upgrade:WebSocket

Is there something that looks wrong in those headers? Anyone have any idea what might be going on? Its like my computer is blocking websocket messages but not connections.

UPDATE:

Unbelievable. I literally have taken no action to correct this. I haven't restarted, changed settings, or installed or uninstalled anything. But the problem is gone - messages now go through as normal. Why is this happening?

user229044
  • 232,980
  • 40
  • 330
  • 338
B T
  • 57,525
  • 34
  • 189
  • 207
  • have you tried to shutdown your antivirus? It seems the handshake made it through, so it is very suspicious that you cannot send any message. Have you checked the Google Chrome Inspector console? – vtortola Jun 14 '14 at 18:57
  • I don't have antivirus software. And yes of course i've checked the console. – B T Jun 15 '14 at 07:14
  • Did you ever figure this out? I have exactly the same problem on a client PC - handshake/upgrade and then no more messages. Completely puzzled. :/ – Mantriur Mar 04 '15 at 14:24
  • Nope - I bought a new computer and never saw it again (i think - certainly haven't seen it in a long while now) – B T Mar 04 '15 at 19:11
  • I'm having a similar issue, and it doesn't appear to be related to the OS. I was on Win 7 Home and can't get websockets to stay connected. I installed a new hard drive, installed Win 7 Pro and upgraded to Windows 10. Still no browsers can keep a websocket open. My laptop on my same network works fine, so I'm thinking it's network card related somehow. Using Wireshark it appears that after the first message begins to come through, the connection is just dropped. – Tony Maro Aug 04 '15 at 03:01
  • @TonyMaro Are you connecting to a tls websocket server (wss) that's using a self-signed certificate? If so, I've had success by adding the certificate to the browser's (chrome's) whitelist, which isn't simple. See here: http://stackoverflow.com/questions/31664366/chrome-failing-to-connect-to-websocket-server-opcode-1-handshake-was-cancele – B T Aug 05 '15 at 05:11

1 Answers1

0

Try to enable WebSocket Protocol.

Go to : Control Panel -> Program and fonctionality -> Enable or disable windows features