How to update your inbox when a new message arrives (like Gmail)

In my application, I have a mailbox. If a new message arrives, I need to increment the unread counter. Do I need to connect a database each time to find out if a new message has appeared? Are there any other methods?

+4
source share
2 answers

Use Comet and upload changes when new mail arrives.

+4
source

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

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

+2
source

Source: https://habr.com/ru/post/1305193/


All Articles