[Twisted-Python] XWT
Itamar Shtull-Trauring
twisted at itamarst.org
Wed May 8 06:36:55 MDT 2002
Hi,
I discovered XWT yesterday, and *wow*. This is very similar to something
I've wanted to do, and it's very very cool.
Now, the thing is, my vision was slightly different - XWT seems to use the
web model (XML-RPC and SOAP), where you send a request and get a reply, but
there's no way for server to send data to client. A browser is of course
limited to this because of HTTP, but in this case you don't need to limit
yourself.
Why is this a limitation? Consider a chat application. In the XML-RPC model,
you would need to continously poll the server for new messages - and if you
want low latency, you need to send even more requests per second. This is
very inefficent and puts a large load on the server.
What I was thinking of therefore was to use a protocol that is two-way,
allowing the server to send commands to the client asynchronously. These
would basically be GUI events just as you would from, say, Javascript. For
example, in a chat application, a new message would result in the server
sending a "add new text to message display wdiget" command being sent to the
client, without the client having to request it.
In addition for event driven client-server applications, using such a
protocol would also allow building P2P apps that use XWT.
My protocol of choice would be PB, which is a remote object protocol
developed for the Twisted server framework
(http://www.twistedmatrix.com/products/spread). It has implementation in
Python, and a Java implementation I wrote
(http://itamarst.org/software/TwistedJava-0.5.tar.gz). PB is very efficient,
asynchronous, and two-way (for example, encoding an array containing a short
string and two integers will take 150 bytes in XML-RPC, and 20 in PB). It
was designed for chat systems, massive multiplayer games and other systems
where latency must be kept at a minimum.
Given the time I would build such a system - a two-way version of XWT -
using Twisted as a server and PB as the protocol. I don't really have the
time for this right now :) However, some day I probably will, and it'd be
great if I could reuse the XWT code, since most of the code for what I'm
envisioning is basically identical.
I would therefore be very grateful if your design kept such a future
requirement in mind. I'd be even happier if you'd decide to support PB as
well, but I'd guess that's less likely to happen ;)
Anyway - great work!
More information about the Twisted-Python
mailing list