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?

Answers


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.


Need Your Help

Angularjs selectize directive, $digest issues

javascript angularjs angularjs-directive selectize.js

I'm having trouble using watch inside of a directive along with a 3rd party plugin called selectize.

htpasswd on port number

.htaccess .htpasswd

Is it possible to use htpasswd, or some kind of htaccess rule to secure a specific port number. For example I have database profiler running on port 5533, and would like to stop the public accessin...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.