I am using Twisted and I recently discover Autobahn.
I coded a small Twisted web server which dynamically parses the URL, and redirect them accordingly. It’s rather easy to achieve :
root = Resource()
root.putChild(‘s’,File(‘static’)) # static set of files
root.putChild(‘ht’,DynamicHttpProxy()) # dynamic http reverse proxy, depending on the token html arg
site = Site(root)
DynamicHttpProxy is a subclass of Resource which redirects to a dynamically created ReverseProxyResource. With this server :
- http://s/toto.html : serves the static file toto.html
http://ht/dynamic-stuff : decode the ‘dynamic-stuff’ part of the URL, and redirect accordingly
I would like to add a dynamic websocket forwarder using Autobhan : the URL ws://ws/dynamic-stuff should decode the ‘dynamic-stuff’, and open a plain forwarder to an internal service, ie should bridge the incoming websocket connexion to an internal plain tcp service (ie non websocket).
I’ve read rather extensively all the Autobahn|Twisted example, and saw the ‘wrapping’ example page, but I don’t see how to add it to my code (I don’t want to run the separate twistd server).
Does someone know how to achieve this ?