开发者

How to refresh a inbox when a new message is coming.(Like Gmail)

开发者 https://www.devze.com 2022-12-25 04:23 出处:网络
In my application I have an inbox. If a n开发者_开发百科ew message arrives I need to increment the unread count. Do I need to make the database connection for every second to find out if a new message

In my application I have an inbox. If a n开发者_开发百科ew message arrives I need to increment the unread count. Do I need to make the database connection for every second to find out if a new message has arrived? Are there any other methods?


Use Comet, and load the changes when new mail comes in.


Comet is the name given to various types of "server-push" methods that can be used to do what you are looking for. The most compatible of the comet methods is XHR Long Polling.

If you want to try out a specific comet tool, check out jquery comet, which was developed by a SO member. He discusses his plugin at another question.

0

精彩评论

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