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

Drake Smith drakesmith at adelphia.net
Sat Dec 17 06:08:40 MST 2005


(non-HTML version.....sorry about that)

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?

My code:

# ----- Set up the web/CGI server to handle browser-based control -----
from twisted.web import server, static, twcgi
root = static.File("/myResourceDir")
root.putChild("cgi-bin", twcgi.CGIDirectory("/myResourceDir/cgi-bin"))
reactor.listenTCP(8000, server.Site(root))

Thank you.




More information about the Twisted-web mailing list