[Twisted-web] manually inject data into a site object

gary jefferson garyjefferson123 at gmail.com
Mon Dec 26 17:48:19 EST 2011

I have a web service written in twisted-web.

I have it running behind a NAT.

I have a component (based on twisted Protocol) that makes a connection
out from behind the NAT to a relay. Let's call this ReverseThing.

Web clients can connect to the relay to send data back over this ReverseThing.

Once I receive the data, how can I inject it directly into the web
service? Assume both these services run in the same twisted process.

Here's what I've tried: I can pass in the Site object to the
ReverseThing protocol, so that I can call p=buildProtocol() on it,
then I can call dataReceived() manually on that p. But obviously this
doesn't work, because there isn't really a transport object to call
things like getPeer() on.

Is there some other way to send data to a Site, without it actually
coming over the wire?


More information about the Twisted-web mailing list