Re:Gevent, Long-Polling & You
by simonw on Monday August 01, 2011 @07:18AM
(#2831554)
Great article. I'd classify this approach as "streaming" rather than "long polling" though - in long polling, a browser opens a connection to the site which stays open until an event occurs, at which point it closes. As far as the browser is concerned, the request just took a few seconds to return - so the technique often bypasses dubious proxies and other issues (browsers have been really good at dealing with slow loading connections since the modem era).
Streaming is when the connection stays open and multiple messages are sent down the single pipe. It's faster and more responsive (and easier to scale since you don't have to deal with lots of connections being closed and reopened all the time) but is tricker to get working.
Of course, WebSockets make everything work sensibly hence avoiding the need for crazy hacks.
Streaming is when the connection stays open and multiple messages are sent down the single pipe. It's faster and more responsive (and easier to scale since you don't have to deal with lots of connections being closed and reopened all the time) but is tricker to get working.
Of course, WebSockets make everything work sensibly hence avoiding the need for crazy hacks.
Here's a deck from a talk I gave on Comet back in 2008 which touches on some of this stuff http://lanyrd.com/2008/skillswap-goes-javascript/skq/