[Twisted-Python] Twisted Endpoints and WebSocket / Autobahn

Tobias Oberstein tobias.oberstein at tavendo.de
Tue Dec 31 11:33:33 MST 2013


> 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;)





More information about the Twisted-Python mailing list