Running Flask and Autobahn WAMP Server on the same port

1.8k views Asked by At

I understand there is a example on how to run a PythonAutobahn websocket server and a Flask server together in twisted (see below):

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_wsgi/server.py

However, I would like to do the same with a WAMP Server, and I cannot find a simple way.

Is there a easy example on how to do it?

2

There are 2 answers

0
oberstet On BEST ANSWER

Crossbar.io allows you to run Web services (like static or WSGI) together with a WAMP router on 1 port. Please see here.

Please note that, strictly speaking, there are only WAMP routers and WAMP clients. "server" is a WAMP transport level artifact. Please also note, that we are moving all WAMP router code to Crossbar.io.

If you are fine with something that "feels like Flask", but works fully asynch., you might be interested in Klein. Please see here and here.

0
Jonathan Eunice On

It is unclear to me from your question whether simple + Flask + WebSocket + WAMP is the key, or whether you also require that the WebSocket support be provided by Autobahn.

If it is the former, and Autobahn is optional, here is an example of a simple coresident Flask and WebSocket server: flask-as-example Unlike Autobahn, it uses gevent rather than Twisted or asyncio for its concurrency.