Best way to implement real-time interface updates such as SO "new response" notification?

What is the suggested template for providing real-time user interface updates in a web application? For example, when answering a question about SO, another user sends an answer and a prompt appears. Also, if every page on your site provides this feature, how can you avoid overloading the server with too many AJAX calls?

+4
source share
2 answers

Just start the timer and poll the server through XmlHttpRequest . This is not how you need instant updates; AFAIK, SO polls at the 30 second interval, but it's too slow for me, so I put together a Greasemonkey script to check every 15 seconds.

+4
source

I think using a comet for this would be one approach. ( Comet Info here and here )

With comets, you can click the answer or any information that you have on the server when you have information, so you will not ask for information from the client every X times.

But as a flaw, like, tvanfosson and Josh make me notice that it will block the HTTP connection in the read state of the client for long periods.

+2
source

All Articles