开发者

How does the Notice Area on Facebook works?

开发者 https://www.devze.com 2023-02-24 11:22 出处:网络
How does the notification area on Facebook works? I\'m taking about the automatically red box that appears.

How does the notification area on Facebook works?

I'm taking about the automatically red box that appears.

If I have a message/something new on my wall.

I 开发者_StackOverflowbelieve it is also in Stack Exchange, is that a Javascript interval?


Please see this thread

How does one do realtime updates of a web page?


Not sure about this, but I'd wager that both Facebook and SO use an implementation of Comet. Basically, you make a request to the server which is designed to be kept open a really long time, and the server only responds when it has something to say. When the request times out (or receives data back) you simply start up another one. This way you get as close to real-time data as you can without wasting a ton of bandwidth on empty requests.

0

精彩评论

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