[Twisted-web] Replacement for handler in LivePage?
Eric Faurot
eric.faurot at gmail.com
Fri Sep 16 04:47:03 MDT 2005
I'll jump in here to let you know about the work I've been doing after
Jp's callRemote idea/branch regarding livepage.
Basically, the idea is to have all live interaction done as RPC calls
between the server and the browser, or more specifically between
remote objects exported by the server and the client over a
connection.
A live resource establishes and maintains a connection between the
server and the client. It is also used as a broker for remote
objects. So upon connection, both sides get a remote reference to the
other end's root object: by default the LiveResource itself for the
server, and the 'Page' singleton on the client side.
On both sides, calling a remote method (via obj.callRemote(...))
returns a deferred that will be fired when the result arrives. Note
that we only pass data around, no serialized JS code (though this
might happen for special things later). All pages updates are supposed
to be handled by the client itself. This way, we get something
"vaguely ressembling" pb, where only application data are exchanged
and the interface itself is fully managed by the client.
The implementation I have now (which has changed drastically as my "JS
skills" improved) would allow the live client to connect to multiple
servers at the same time, possibly exposing a different root object
for each of them. The first resource is just used for bootstrapping.
Serilialization and parsing still have to be fixed. Although it
relies on twisted, it is rather framework-agnostic for the web part
itself, and it currently works with either tw.web2 or nevow.
Current code available at:
http://ekyo.nerim.net/python/liveresource.tgz
Comments/ideas welcome. If people are interrested in hacking on it
that would be nice.
Eric.
More information about the Twisted-web
mailing list