On Apr 4, 2011, at 7:51 PM, David Bolen wrote:

> Jashank Jeremy <[email protected]> writes:
> 
>> 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?
> 

> To insert your own protocol code, you want to set the "protocol"
> attribute of your Site (or HTTPFactory if using that directly)
> instance to your own "hybrid" protocol class.

It would be slightly better to override buildProtocol, because that way you can 
call the superclass's implementation more idiomatically.  But, the idea is the 
same.

Note that we'd really like to have protocol switch functionality built into 
Twisted proper so that you don't have to jump through all these hoops.  Please 
feel free to contribute patches to fix this ticket: 
<http://twistedmatrix.com/trac/ticket/3204>.


_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to