[Twisted-web] Using Twisted Web for browser-based control

Drake Smith drakesmith at adelphia.net
Sun Dec 18 06:44:03 MST 2005

At 11:22 AM 12/18/2005 +0200, you wrote:
>Drake Smith wrote:
> > I use Twisted Web on an embedded Linux device to provide browser-based
> > configuration & control. The browser displays a bar graph of a parameter
> > that is quickly changing on the embedded device (peak audio level). In
> > order to provide a reasonable feedback to the user, the browser connects
> > to the Twisted Web CGI server once a second via XMLHTTPRequest to obtain
> > an updated bar graph level, then Twisted Web dutifully closes the
> > connection. Is there a way to achieve the same thing without opening &
> > closing a connection each time?
>AJAXy things in nevow.athena may be attracting to you, as pointed out
>elsewhere. If you for some reason don't want to use them, the old school
>way is to have the bar graph as a GIF with more than one frame, and
>stream the frames whenever you want to update the picture; that keeps
>a single connection open to the server, pushing more data exactly when
>you want to. Of course, it is limited to updating 1-4 GIF images.

Thanks for chiming-in Tommi because keeping the connection open is really 
where I was leaning. I never had any luck doing this with Python's 
CGIHTTPServer module but I expect this will be no problem with Twisted Web 
or at least Twisted Web2. I am eager to revisit the "open connection" 
approach in light of JP's implication that AJAX-like functionality does not 
necessarily reduce the traffic between client & server -- my original goal. 
Be that as it may, athena.livepage is such an improvement over HTTP's 
request/response model that I will pursue that as well.

More information about the Twisted-web mailing list