views:

257

answers:

2

Hi all,
I want to create a little social network (a little test). How can i implements period ajax call like Facebook ?
I need to update news, status,...
How does it Facebook ?

+1  A: 

You can use setTimeOut and setInterval in javascript to time ajax calls.

EDIT:

If there are no changes you can use a larger time before for the next interval. This is sometimes called Exponential Backoff.

Paul Whelan
I know this solution, but is it the only way ?Because if there are no changes i got overhead, no ?
enfix
Why don't you try some AjAX framework which will handle all background complexity. May be DWR
VinAy
A: 

A technique called "Comet push", which can perform real-time server information push, may suit your need. As far as I know, it can be implemented in Ruby(Dojo) and ASP.NET (handlers). The "chat" function of Facebook uses Comet-like architecture.

http://en.wikipedia.org/wiki/Comet_%28programming%29

ZEAXIF