Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does stackoverflow implement the continual page updates? [duplicate]

It's stunning - you open stackoveflow question and the page is modifying itself in front of your eyes!

"Ah, that's obvious", I thought. They just keep sending AJAX requests to the server to check if something changed.

Nope! I opened Firebug plugin for Firefox and looked at the Net panel. There were no AJAX requests sent during several minutes. And as you may have experienced, the page is updated much more often than once per minute!

Do you have an idea how is this implemented?

like image 736
Tomas Avatar asked Jan 05 '14 16:01

Tomas


2 Answers

Usually someone coming from Node.js uses socket.io for something like this. However SO uses C# / ASP.NET MVC so their equivalence of socketio would be SocketIO4Net.

like image 89
Alex Shilman Avatar answered Sep 28 '22 14:09

Alex Shilman


I don't know for sure but I'd expect it is using WebSocket in HTML 5 and Long Polling before then. Those are the usual approaches for this sort of live update functionality.

http://en.wikipedia.org/wiki/WebSocket

http://en.wikipedia.org/wiki/Push_technology

like image 45
Tim B Avatar answered Sep 28 '22 14:09

Tim B