Need this ajax long polling example explained

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
slick1537
Forum Newbie
Posts: 3
Joined: Tue Jan 18, 2011 9:28 pm

Need this ajax long polling example explained

Post by slick1537 »

Hey all!

I was reading this example http://blog.perplexedlabs.com/2009/05/0 ... g-polling/ that explains what ajax long polling is and a simple means to implement it. Based on that reading though I have a question. If the script on the server side does not find any new data to send back to the client, it terminates after 30 seconds. If the client does not receive a callback how does it know to close and re-open the connection? Thanks!

- slick1537
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Need this ajax long polling example explained

Post by Christopher »

I think the idea with long-polling is that the server does not close the connection but keeps sending data as it is available on the same connection. The client waits for data on the same connection. The problem is that the webserver needs to be configured to support a large number of simultaneous connections.
(#10850)
Post Reply