Closed Fjf closed 8 months ago
This is not an issue. The way Flask extensions attach to a Flask application instance makes it impossible to have two active instances of an extension attached to one application. What you need to do is create two Flask applications, then attach a Flask-SocketIO instance to each. Finally use a dispatcher middleware to route traffic between the Flask applications.
Describe the bug I have an application which attempts to have two separate SocketIO instances over different paths (e.g.,
localhost:80/socket.io
andlocalhost:80/socket.io.2
). This seems to be not supported, as the lastsocketio.init_app(app)
will take precedence over what events thetest_client
will receive. However, I do seem to get the events when running it 'deployed' over gunicorn+eventlet.To Reproduce Initialize two socketio instances with the
init_app
constructionThen have a test looking like this:
Expected behavior Regardless of initialization order, both socketio instances should be valid for testing.
Logs
When initializing in the order (sio -> sio2)
When initializing in the order (sio2 -> sio)