[Twisted-Python] Two-Way Web

Donovan Preston dp at ulaluma.com
Thu May 9 12:44:31 EDT 2002


Two-Way Web is the idea that the server should be able to "push" data to 
a web browser as long as that web browser is open. Along with Mukhsein, 
I too cannot fathom why the big browser giants never implemented 
anything like this. I suppose Netscape thought they were doing it with 
Java and LiveConnect, but Java takes far too long to initialize and is 
far too big for it to be a viable option for me.

Mukhsein has covered most of the bases when it comes to Java options, 
and I was not aware of multipart/x-mixed-replace which might be an 
interesting idea if it can work cross-browser, but there are a couple 
more options I'll bring up. None are particularly satisfying, but 
neither are the Java options. Of course, the "build your own rich 
desktop web-browser replacement" idea is the ideal, but while it is an 
attractive idea I don't see it gaining as wide an audience as a 
relatively pure web solution would.

First, there's KnowNow, who have implemented a Frame-based, 
JavaScript-based event router system. There are three frames, the main 
frame, and two invisible communications frames, one "in" and one "out". 
The "in" frame must be kept alive somehow by simply never closing the 
document, but continuously sending JavaScript upon events occurring on 
the server. The "out" frame is controlled by the main page's JavaScript 
and is manipulated in response to button clicks and typing to cause a 
POST to the server with some updated data.

Then, there's my "Extremely lightweight Flash 5 movie which opens a 
persistent connection to the Twisted server" idea. I had this idea over 
a year ago when Flash 5 first came out, and added support for a 
persistent socket connection to a server. I have reimplemented my 
original proof-of-concept using Twisted as the server the movie connects 
to, and I'll be toying with coming up with an architecture within 
Twisted and within the Flash movie that will allow real-time 
communication both ways, probably involving LiveConnect between the 
Flash Plugin and the JavaScript engine in the browser.

I know none of these ideas are ideal, but to me it's mostly about 
exploring what is possible in the most lightweight, non-intrusive 
manner. To me, it's about proving that something can be done a 
particular way before committing to writing a large amount of code to 
support the system.

Ultimately, I would like to understand a little more about how the 
existing PB infrastructure could be leveraged in a system like this, and 
hopefully we can come up with a single back-end API and message flow 
strategy that could be used with multiple front-ends.

Thoughts?

Donovan





More information about the Twisted-Python mailing list