[Twisted-web] Implementing hanging get with twisted web

Jean-Paul Calderone exarkun at divmod.com
Sat Nov 11 13:16:13 CST 2006


On Sat, 11 Nov 2006 11:06:07 -0800, joe kim <joe.kim at gmail.com> wrote:
>Hi all,
>
>I had a question about implementing hanging-gets.  A hanging get is
>basically when the server "hangs" onto the http request until either a
>certain period of time or until there is an event is triggered.  It is
>a hack for implementing event driven messaging on top of HTTP.
>
>Alex Russell references it in his blog:  http://alex.dojotoolkit.org/?p=545
>
>What's the best way to implement hanging-gets using twisted?  I have a
>web page that I want to immediately update everytime there is a change
>to the data.  Making asynchronous javascript requests every second do
>not really make sense, but I was thinking that if the javascript
>continually made asynchronous requests to the server and the server
>implemented hanging-gets, then that would be a good solution.
>
>Any thoughts are appreciated.

See http://divmod.org/trac/wiki/DivmodNevow/Athena

The basic mechanism in twisted.web which this relies on is a renderHTTP
method which returns NOT_DONE_YET and arranges for request.finish() to
be called at some later time.

Jean-Paul



More information about the Twisted-web mailing list