[Twisted-Python] Twisted Endpoints and WebSocket / Autobahn

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Dec 31 12:01:37 MST 2013


On 06:33 pm, tobias.oberstein at tavendo.de wrote:
>>Is there an example of doing this with 'twistd' anywhere?
>
>I've added a generic endpoint forwarder plugin for twistd to Autobahn:
>
>The example also includes a Terminal running in a browser, which talks 
>over WebSocket
>to the endpoint forwarder in twistd, which forwards the traffic to a 
>Telnet server:
>
>http://picpaste.com/Clipboard24-LLwRCPKG.png
>https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wrapping 
>#endpoint-forwarder
>
>In other words: this shows that endpoint plugins can be combined with 
>twistd plugins.
>
>The forwarder should be able to forward between any pair of Twisted 
>stream server endpoint
>to any stream client endpoint.
>
>As soon as the Process endpoints are ready (the parsing), this would 
>allows to expose programs stdin/stdout to WebSocket eg.
>Or access any serial device over WebSocket (when serial endpoints are 
>there).
>
>This functionality is the equivalent (actually a superset) of the 
>following projects:
>
>https://github.com/kanaka/websockify
>https://github.com/joewalnes/websocketd
>
>Cheers,
>/Tobias
>
>PS 1: I couldn't get Manhole fully working with the JS Terminal:
>https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wrapping#manhole
>
>PS 2: the forwarder is _generic_
>https://github.com/tavendo/AutobahnPython/blob/master/autobahn/autobahn/twisted/forwarder.py
>and probably should not be part of Autobahn but Twisted. And it should 
>be robustified;)

Indeed.  This should ultimately be what `twistd portforward` offers. :)

https://twistedmatrix.com/trac/ticket/4927 is related.

Jean-Paul



More information about the Twisted-Python mailing list