What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

This is just out of curiosity. I am seeing live data getting pushed and updated on Stack Overflow question pages.

Example -

  • While I am seeing an answer posted, if the author is updating his answer or the question is modified, I see messages like - 'this answer is changed / updated, click to load'.
  • The time keeps updating without a page refresh, minutes keeps increasing showing the time since the answer or question was posted.

I understand there are tools like Node.js and other server push technologies which makes this possible, but I am just thinking: What is Stack Overflow actually using and how are they doing this?

share|improve this question

migrated from stackoverflow.com Nov 20 '12 at 15:37

This question came from our site for professional and enthusiast programmers.

    
This offers a brief overview of what StackExchange uses: blog.stackoverflow.com/2008/09/… –  Arran Nov 20 '12 at 14:52
    
Thanks @Arran, this is helpful but still thinking about the live push, is it node.js or something in C# and asp.net, any guesses ?? –  Anmol Saraf Nov 20 '12 at 14:55
    
node is not used in SO. –  Oded Nov 20 '12 at 15:39
    
see: meta.stackexchange.com/questions/10369/… –  gnat Nov 20 '12 at 15:53
    
possible duplicate of meta.stackexchange.com/questions/125677/… –  NullUserException อ_อ Nov 20 '12 at 17:49

1 Answer 1

up vote 3 down vote accepted

While I am seeing an answer posted, if the author is updating his answer or question is mofified I see messages like - 'this answer is changed / updated, click to load'.

It use to be done with long polling - JavaScript running on a schedule checking a web service end point to see if things have change. They may have move to use Web Sockets with a long polling fallback.

The time keeps updating without page refresh, minutes keeps increasing showing the time since the answer or question was posted.

This is just client side JavaScript - the page has an ISO-8601 timestamp that is read by JavaScript in a setInterval (or setTimeout - not sure which one) loop that updates the display according to the amount of time that passed.

share|improve this answer
    
setInternal --> setInterval. I would have edited it myself but it wasn't > 6 characters. –  ɹǝʞɐʇıɥʍ ʍǝɹpuɐ Nov 20 '12 at 17:03
    
@ɹǝʞɐʇıɥʍ ʍǝɹpuɐ - thanks –  Oded Nov 20 '12 at 17:11
    
Thanks @Oded, very correct, following code snippet from their source code also says that they have moved to websockets now - StackExchange.realtime.init('ws://sockets-se.or.stackexchange.com'); StackExchange.realtime.subscribeToInboxNotifications(); StackExchange.realtime.subscribeToReputationNotifications('4'); }); –  Anmol Saraf Nov 21 '12 at 14:27

You must log in to answer this question.

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