views:

40

answers:

2

How do I implement a real time updating /live html streaming method in applications like FriendFeed, Stackoverflow, Blip.fm ?

Is it done using a jQuery/Ajax request from client to server every X seconds? (FriendFeed is like every 1 second) or there is another technique?

+1  A: 

Yes the most common method is to use ajax with a client and server framework (such as jQuery and ASP.NET, jQuery and PHP, Prototype and X, etc.)

Since the web is 'stateless' you have to have some sort of clientside 'polling' mechanism that will periodically talk to the server and update the UI.

KP
every second hit to server is getting too expensive when you have lots of users
mohamadreza
+1  A: 

There are a lot of techniques and ideas that started to came up with the need of a more interactive web.. You can find some reference here at stackoverflow

You can reseach about Comet , Polling and javascript, etc.

What SO does is to check the activity by using an ajax POST request to http://stackoverflow.com/posts/2977129/answer-activity-heartbeat for example in this question page. The request returns whether there was some activity happened or not, and an action is taken accordingly.

Matias