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.
精彩评论