During the day I usually leave a Stack Overflow page open on one of my screens. While I'm working on another screen I can see whenever the question or an answer is voted on immediately, and I get message alerts whenever someone answers or replies to one of my posts immediately as well.

I was just wondering how this is accomplished without having to refresh the page. Is the browser constantly communicating with some server in the background? I really like this feature and want to know more about how it works.

  • You might want to take a look at Comet (Web Application Model), specifically AJAX with Long Polling – Matias Cicero Aug 28 '15 at 19:26
  • @MatiCicero Thanks, I'll look into those – Senju Aug 28 '15 at 19:39
  • I think SO uses Socket.io for real-time notifications though (which is another technology). SO has the domain sockets.stackexchange.com for establishing web socket connections. You'll get a 502 Bad Gateway if you go there because you can't connect to a websocket using http: protocol, you need to use ws: (unsecure) or wss: (secure) – Matias Cicero Aug 28 '15 at 19:39
  • @MatiCicero Not socket.io, just websockets. We don't use node.js on Q&A sites. – Adam Lear Aug 28 '15 at 20:43
  • 1
    related: meta.stackexchange.com/questions/10369/… – rene Aug 28 '15 at 20:48
  • 1
    related: meta.stackexchange.com/a/168148/254554 – HackerKarma Aug 29 '15 at 1:32
  • @AnnaLear you don't use node... "on Q&A sites"? Does SE use node.js somewhere? – nhinkle Aug 30 '15 at 17:08
  • @nhinkle For running some scripts during builds. We used to have a node-based project, but switched back to C# now. There may be some in internal tools, but I don't know for sure off the top of my head. – Adam Lear Aug 30 '15 at 17:19

You must log in to answer this question.

Browse other questions tagged .