Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polling vs long-polling [closed]

What are the differences between polling and long polling? What are the advantages and disadvantages? Is Ajax considered as long-polling?

like image 480
Sam Jelveh Avatar asked Oct 24 '25 08:10

Sam Jelveh


1 Answers

polling: hitting a url from a client at some interval

long polling: hitting the url from a client and having the server hold the connection for a period of time, in this way the server can return the connection at the moment when it has information for the client

Not all ajax is long polling. Long polling is best achieved using a framework like cometd. (http://www.cometd.org)

like image 152
jesse mcconnell Avatar answered Oct 27 '25 02:10

jesse mcconnell