Implementing hanging get with twisted web

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.
Cheers, Joe

On Sat, 11 Nov 2006 11:06:07 -0800, joe kim joe.kim@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

On 11/11/06, Jean-Paul Calderone exarkun@divmod.com wrote:
On Sat, 11 Nov 2006 11:06:07 -0800, joe kim joe.kim@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
Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
Thanks for the link. I was using HTTPFactory, HTTPChannel, http.Request for my implementation. I have not tried Athena yet. I will give it a try.
Joe
participants (2)
-
Jean-Paul Calderone
-
joe kim