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?
Use Comet and upload changes when new mail arrives.
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 .
Source: https://habr.com/ru/post/1305193/More articles:Removing last word from FOREACH loop - phpEasy way to convert strings 0 and 1 to character? Plain C - cHow to read the directory structure of IIS 6 sites using WMI? - c #How can I get rid of an object (say Bitmap) when it becomes an orphan? - c #Preventing spawning processes using .NET code - c #How to save headers for all pages of exported pdf in php? - phpFlex: add 1 day to a specific date - dateC # Generics Casting - genericsHow do I know if a site works on Drupal? What are the markup patterns? - drupalWhy can't I use 'continue' inside a switch statement in Java? - javaAll Articles