Sometimes I see the "new question with activity message", my score increments automatically without refreshing, "an edit was made, click to refresh" and all other Ajax responses. 90% of the time this doesn't work, and I have to refresh manually to get all the updates. Why?

I am running Windows XP SP3, Firefox 24.0 with a handful of add-ons (I tried running with add-ons disabled, and the problem remains).

I noticed by looking at the Firebug console that I get the following error whenever I navigate to Stack Overflow:

NetworkError: 502 Bad Gateway - http://sockets.ny.stackexchange.com/"

I don't know if it relates to the problem.

(I send the administrators this question and they told me to ask here, so here we are.)

  • 2
    Are you behind a proxy of some sort? – Pekka Oct 7 '13 at 18:12
  • What does websocketstest.com say? All green? – Oded Oct 7 '13 at 18:20
  • @perhapsPekka No, but you gave me something to try. I will try to use a proxy and see what happens. – Ibrahim Najjar Oct 7 '13 at 18:22
  • @Oded Not all green, both port 80 and port 8080 are failing the tests. – Ibrahim Najjar Oct 7 '13 at 18:23
  • 1
    @Oded here is the test. – Ibrahim Najjar Oct 7 '13 at 18:24
  • @perhapsPekka After testing with a proxy server the problem remains, now I get 403 forbidden response for the http://sockets.ny.stackexchange.com/. – Ibrahim Najjar Oct 7 '13 at 18:28
  • You need to look into the causes for port 80 being blocked. Firewall? ISP? – Oded Oct 7 '13 at 18:30
  • @Oded I tried a proxy server but it didn't work. There is no firewall installed except for windows firewall. – Ibrahim Najjar Oct 7 '13 at 18:32
  • @Sniffer - I wouldn't expect web sockets to work until you manage to get port 80 green on the test site. – Oded Oct 7 '13 at 18:33
  • @Oded OK Thank you for help. I will look into why those two aren't working. – Ibrahim Najjar Oct 7 '13 at 18:38
  • @probablyPekka I have edited my answer to his question, please check edit. – Ibrahim Najjar Oct 26 '13 at 19:52
  • @Oded I have edited my answer to his question, please check edit. – Ibrahim Najjar Oct 26 '13 at 19:53

Thanks to helpful comments from both @perhaps Pekka and @Oded, I was able to narrow down the cause of the problem to WebSockets not working on port 80, thus not getting real time feedback from the server.

The actual reason for WebSockets not working on Port seems to be caused by the ISP, because when I tried to connect through the Tor network I started to get feedback immediately.


This is Day: 27, Month: 10, Year: 2013. I noticed that websockets are working correctly today even though when I run the tests against websocketstest.com I still get the same results, I am not using any proxy servers as well. Things just started to work on their own.

One thing I have noticed that changed is that now by looking at Firebug I can see that my browser tries to connect to qa.sockets.stackexchange.com instead of http://sockets.ny.stackexchange.com/ which might be the reason. until I make sure I will ask the admins.

Answer to edit:

As @Marc Gravell has explained in his comment, qa.sockets.stackexchange.com uses wss:// protocol and thus SSL which is better and obviously works in my case. @Oded has told me before that Stackoverflow is switching to secure websockets and they have delivered as promised.

Thanks to all Stackoverflow team for their amazing job !

| improve this answer | |
  • Some ISPs use caching proxies to save bandwidth, and they far too often just kill websocket traffic (mostly, unknowingly). That's why we're going to SSL for websockets, since it should bypass proxies automatically. – Tim Post Oct 8 '13 at 17:09
  • @TimPost I hope you get that done ASAP, I am looking forward to it. Great job guys and Thank You. – Ibrahim Najjar Oct 8 '13 at 17:27
  • What you might also notice is that "qa.sockets..." is actually "wss://", where-as "sockets.ny..." is "ws://" - basically, "qa" is our web-socket provider over SSL, which works much better with meddling intermediaries like proxies and ISPs, because they can't see that the data isn't actually http. – Marc Gravell Oct 26 '13 at 21:01
  • @MarcGravell Thank you very much. Oded told me that you were switching to wss but I didn't notice that when I looked at Firebug. This must have fixed the problem because when I visit [websocketstest](websocketstest.com) I can see that websockets work without any problems over SSL connections. Thank you again. – Ibrahim Najjar Oct 26 '13 at 21:19
  • @Sniffer sorry if it has taken a while - unfortunately, at stackoverflow scale it isn't quite as simple as "add this library" or "enable this switch" - iirc in this case we were working iteratively with the author of haproxy to work through issues – Marc Gravell Oct 27 '13 at 7:39
  • @MarcGravell I think you did a great job, thank you again. – Ibrahim Najjar Oct 27 '13 at 14:00
  • Hello @MarcGravell, What happened ? It looks like we are back to square one, after Stackoverflow went down for maintenance and came back I found that websockets aren't working again and it seems because you went back to use non SSL solution ? Why so ? Thank you. – Ibrahim Najjar Oct 30 '13 at 19:20
  • 1
    @Sniffer so had a network outage earlier due to some network device issues. While we investigate and repair we've defaulted to minimum impact, meaning: WS rather than WSS for now. Will be back real soon. – Marc Gravell Oct 30 '13 at 19:24
  • @MarcGravell Thank you for the up to date information, hope you get this fixed soon. – Ibrahim Najjar Oct 30 '13 at 21:20
  • 1
    @Sniffer to be clear: AFAIK the wss was not part of the problem - simply part of our "strip down the system to get back online asap" – Marc Gravell Oct 30 '13 at 21:23

You must log in to answer this question.

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