This issue was fixed in later versions of Firefox and no longer applies

It is kept here for reference for those having to use legacy browsers for specific reasons. Otherwise please upgrade to the latest version.

Fx 12 on XP

Timestamp: 08-06-2012 11:02:18
Error: Firefox can't establish a connection to the server at ws://sockets.ny.stackexchange.com/.
Source File: http://cdn.sstatic.net/js/full.js?v=3ea93510c9eb
Line: 11

Getting this repeatedly - do you want me to report such things or are they possibly too localised to whatever is happening with my connection right now?

Webtest - and I am not on a wireless

enter image description here

Some other screenshot showing the issue:

  • Do the live updates work for you? In other words: is that connection failing sometimes, or always? Any chance you're on wireless and changing access points? Any luck with websocketstest.com?
    – Arjan
    Jun 8, 2012 at 10:42
  • Pls see update. I do not see anything adverse - it is just super annoying since I have the error console open for other reasons.
    – mplungjan
    Jun 8, 2012 at 11:17
  • 1
    If websocketstest.com is failing too, then I guess the only possible Stack Exchange bug is that it logs messages to the console? However, as an aside: when I'm peeking into the Firebug Console rather than the Firefox error log, then I only see the messages of a single window. That might help a lot for any development you're doing.
    – Arjan
    Jun 8, 2012 at 12:48
  • (Just to be sure: I assume websocketstest.com showed failures on its website? Its logging might not be too important. But if the results on their website tells you websockets don't work in your browser/firewall/virusscanner/network, then the SE live updates won't work either.)
    – Arjan
    Jun 8, 2012 at 12:59
  • Are you behind a proxy server?
    – kakridge
    Jul 24, 2012 at 19:28
  • Yes. I will not be back until mid September though
    – mplungjan
    Jul 25, 2012 at 7:08
  • @mplungjan does this only happen when you're behind a proxy server? I'm tempted to think that your proxy server can't handle the protocol switch (upgrade)... Can you reach sockets-se.or.stackexchange.com/ping ? Nov 5, 2012 at 14:09
  • I would say the problem has gone away. I have updated the question (delete it?) to mention I am now on Fx15 - I suggest you take it up with the other person here : F. Hauri
    – mplungjan
    Nov 5, 2012 at 14:11

2 Answers 2


It works fine from here ;p

I strongly suspect that this is primarily the effect of down-level intermediary proxy servers mangling the web-socket request. In most cases... "squid". Basically, a web-socket request is meant to have something like (as http-headers):

Connection: Upgrade
Upgrade: websocket

plus some other headers, such as Sec-WebSocket-Version and Sec-WebSocket-Key for up-to-date implementations (RFC6455 and most of the Hybi versions), or Sec-WebSocket-Key1 and Sec-WebSocket-Key2 (for the early implementations, Hixie-76).

We even accept multi-value headers that we see in-the-field, such as:

Connection: Upgrade, Keep-Alive
Upgrade: websocket

even though that isn't really all that meaningful (it doesn't make sense to ask whether a web-socket connection has "keep alive" enabled). However, we get a constant stream of requests of the form:

Connection: Keep-Alive

(with no upgrade header), or

Connection: Keep-Alive
Upgrade: websocket

which are... not web-socket requests. I know that no web-socket aware browser issued that request, so it basically screams "dodgy proxy server". If you have a dodgy proxy server that doesn't know how to change protocol to web-sockets, then the chances are good that it would get very ill if we did change protocol, so if we see something obviously bad we kill the connection dead, to protect all parties.

Perhaps the best thing to do is to look at http://websocketstest.com - if that reports errors, then we can't help - your network infrastructure is actively preventing successful use of web-sockets. Also note the caveats from that page:

Antiviruses, firewalls and HTTP proxies may interfere WebSocket connections, sometimes rendering them useless.

The good news, however, is that we only use web-sockets for nice to have functionality. Web-sockets being down does not stop your usage of Stack Exchange - it just prevents instant updates. We also use web-sockets on the chat system, but we fallback to polling if we can't establish a web-sockets connection.

  • So bottom line you blame the workplace of users suffering from those things? Nov 5, 2012 at 14:34
  • @ShaWizDowArd well, if their proxy server destroys the request, then: yes. I'm open to suggestions, of course. But the log output from websocketstest.com (in the question) kinda says it all, really. Nov 5, 2012 at 14:35
  • Marc, I've started having this issue with Firefox 17.0.1 and Chrome Latest, only on SO. Not Superuser, not Meta.SO, just SO. I get this error in Chrome: Invalid url for WebSocket ws://sockets-se.or.stackexchange.com:80%2Csockets-se.or.stackexchange.com:443/, and I get no errors at websocketstest.com Should I report this as an issue? All kinds of goofy stuff isn't working, too. Dec 27, 2012 at 22:49
  • @JaredFarrish Just refresh your browser. This was a temporary thing that should be fixed by now.
    – Adam Lear StaffMod
    Dec 27, 2012 at 23:12
  • @AnnaLear - Thanks; I had to restart and clear my cache. Dec 27, 2012 at 23:17
  • wish i could answer "wfm" when my software has bugs, and get away with it
    – mxmissile
    Apr 12, 2013 at 21:46

OUTDATED - 2013-05-28

There was more than 5 major upgrades in Firefox, from the time this question was asked.

Now this work fine with the version 21 and 22 of Firefox.

This seem not to be an SO issue, in fine.

Original post - 2012-11-04

I know Me too answer are not welcome on SO, but...

I'm using Firefox 17.0 (french version), behind a proxy and a firewall.

The dialog with websocketstest seem pretty good:

WebSockets supported    Yes✔
1.1 netmaster:3128 (squid/2.7.STABLE9)
WebSocket protocol version  rfc-6455
WebSockets (Port 80)
Connected   No✘ Disconnected at 22:0:36
WebSockets (Port 443)
Connected   Yes✔
Data Receive    Yes✔
Data Send   Yes✔
Echo Test   Yes✔
Server time 2012/11/4 21:07:28
WebSockets (Port 8080)
Connected   No✘ Disconnected at 22:0:37
WebSockets (Port 443, SSL)
Connected   Yes✔
Data Receive    Yes✔
Data Send   Yes✔
Echo Test   Yes✔
Server time 2012/11/4 21:07:28
Comet (Port 80)
Connected   Yes✔
Server time 2012/11/4 21:07:28

But, as I'm writting this (with some SO windows opened on background), the error console display:

Horodatage : 04. 11. 12 22:05:12
Erreur : Firefox ne peut établir de connexion avec le serveur à l'adresse ws://sockets-se.or.stackexchange.com/.
Fichier Source : http://cdn.sstatic.net/js/full.js?v=60ed68b57396
Ligne : 12

Horodatage : 04. 11. 12 22:06:12
Erreur : Firefox ne peut établir de connexion avec le serveur à l'adresse ws://
Fichier Source : http://meta.stackoverflow.com/content/js/full.js?v=60ed68b57396
Ligne : 12
  • Any word on other browsers on the same machine?
    – Arjan
    Nov 4, 2012 at 22:10
  • with google chrome (17.0.963.56), this seem work... At all, for now, I didn't become anything on console log... Even after connecting french.stackexchange.com. This seem linked to Firefox!? Nov 5, 2012 at 0:36
  • Another one: sockets-se.or.stackexchange.com
    – Benjol
    Nov 5, 2012 at 6:49
  • 502 Bad Gateway The server returned an invalid or incomplete response... on both firefox and chrome. Nov 5, 2012 at 7:27
  • I'm using FF 16.02, which is AFAIK the current stable build. That works fine. As does chrome... is this perhaps a bug in the pre-release version of Firefox? Nov 5, 2012 at 14:01
  • @F.Hauri you can ignore the bad gateway - that is because we don't support http on there - it is a pure web-socket server. Although, if you hit /ping it'll probably give you a http response. Nov 5, 2012 at 14:03
  • BTW, in your output, I notice the "Connected No" for port 80 / 8080 - which supports my theory that your proxy really doesn't like it Nov 5, 2012 at 14:42
  • 1
    Well! Ma case seem to be linked to Squid (v2.7): I've commented out the line: http_access deny CONNECT !SSL_ports and this seem work now... But! Why chrome could and not firefox!? Nov 5, 2012 at 16:55
  • @F.Hauri I tried the same as you. It worked both in Firefox and Chrome.
    – user4035
    May 27, 2013 at 22:53
  • @user4035 Yes, this thread is not recent... There was some upgrades version of Firefox, from the time I wrote this. I was speaking about FF17. Now there is approx 5 major upgrades.... May 28, 2013 at 8:17
  • @F.Hauri , presently the Firefox version which i am using 36.0.4, but still getting the same error " Firefox can't establish a connection to the server at wss://localhost:9001/ws. Apr 16, 2015 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .