I don't know what he does there, or what would be the equivalent for Ruby/Rails (that time.sleep(1) doesn't look good), but in Python one could use something like Gevent for long-pooling, which uses livevent to implement micro-threads: http://www.gevent.org/
It's not the same thing, because when server finally sends a response, the connection is then closed. But it's trivial to write a custom WSGI middleware, that sends a chunk of stuff, then releases the thread for other requests.
And doing it this way, you could have thousands of connections open with a single server instance.
I don't know what he does there, or what would be the equivalent for Ruby/Rails (that time.sleep(1) doesn't look good), but in Python one could use something like Gevent for long-pooling, which uses livevent to implement micro-threads: http://www.gevent.org/
Here's a sample that uses Gevent/Django: https://bitbucket.org/denis/gevent/src/tip/examples/webchat/...
It's not the same thing, because when server finally sends a response, the connection is then closed. But it's trivial to write a custom WSGI middleware, that sends a chunk of stuff, then releases the thread for other requests.
And doing it this way, you could have thousands of connections open with a single server instance.