Simple HTTP streaming with Twisted & Javascript

When writing web based apps a recurring problem is updating page contents in response to server side events. A classical pattern to solve it is to do periodic pooling of the server using XMLHttpRequests, however this often leads to making far more HTTP requests than what is really needed. It would be best to be able to originate the update from the server. Emerging technologies such as HTML5 websockets may provide a neat solution in the future, but until they become widely supported by all major browsers your path will be filled of all sort of "workarounds" to emulate the websockets on all those still catching-up. However a simple solution may be at hand in some particular cases: enter the world of html streaming.