[Twisted-Python] Creating a hybrid server in Twisted
Jashank Jeremy
jashank.jeremy at optusnet.com.au
Mon Apr 4 03:28:21 MDT 2011
--text follows this line--
Hi,
I'm trying to write a hybrid server that serves either HTTP or my own
custom protocol depending on how it's addressed (distantly inspired by
the IRC bouncer ZNC). If it receives a standard GET, POST, HEAD,
etc. it sends HTTP traffic, or if it receives the bareword `CORDELIA',
it switches to Cordelia mode.
HTTP works fine with Twisted.Web. I can serve pages over HTTP (which is
my desired outcome). However, I'm not sure how to write the Cordelia
handling code. I've tried my own custom `render_CORDELIA' function, but
it acts too much like HTTP (ie. it returns a result and terminates the
connection), which is not what I want, as the protocol I've designed
involves establishing a two-way conversation, not a single request and
response pair.
So I'm pretty much stuck in a rut. I don't want to totally reinvent the
wheel just to be able to protocol-switch; I'd prefer to make use of
existing code from Twisted. How do I hijack Twisted.Web to add protocol
switching?
Jashank
--
Jashank Jeremy
PGP: 0x25A5C309
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20110404/72583c9f/attachment.sig>
More information about the Twisted-Python
mailing list