mobibob
mobibob

Reputation: 8794

how does Google gmail, docs, etc. get its push-notification of changes?

I would assume that there is an AJAX request on the client side that polls for updates, but it is amazingly tight response. Can someone provide more insight into any tricks that they may be doing in the protocol?

Upvotes: 2

Views: 749

Answers (1)

Déjà vu
Déjà vu

Reputation: 28850

Two methods generally used in this case

  • Polling: the Javascript code polls the server every (for instance) 10 seconds to see if there is some fresh news to show

  • Persistent connection: the XMLHttpRequest request is performed by the client, and the server keeps the connection until there is some news (replies data to client in this case), or if a given time-out is reached - then the client tries again and so on.

Google probably uses the 2nd option, which is replying and updating faster.

Upvotes: 2

Related Questions