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?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With