开发者

AJAX call like Facebook

I want to create a little social network开发者_C百科 (a little test). How can Ii implement periodical ajax call like Facebook? I need to update news, status, ... How does Facebook do it?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜