-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow websocket connections (e.g. python-socketio) on child app #10
Comments
Hi @amaurymercier Yes, unfortunately this problem is caused by Sanic-Dispatcher. The reason this happens is because the child sanic app doesn't actually operate its own http webserver, and it doesn't have a working HttpProtocol object attached. All of that is meant to be handled by the parent app, and requests/responses are just passed to and from the child app. This means there are some things that the socketio library expects the child app can do (like receiving a websocket request), that it actually cannot, that should actually go to the parent app. I think it might be possible to get this working with a new feature in Sanic-Dispatcher, but maybe not. I will look into it. |
Hi @amaurymercier
|
Hi, Thanks a lot for this !! I tested it and it works. Best |
Hi @amaurymercier See that here: The built-in sanic response handler sees the HTTP Response is not I can work around it, as you've suggested, by including an extra check for EDIT: To add, just clarifying, this latest error is not an issue in Sanic-Dispatcher, nor in Sanic-Plugins-Framework, and it is not a result of running on a child app, and is not related to using Blueprints. |
@amaurymercier |
Another comment to add, looks like it is a bug in python-engineio miguelgrinberg/python-engineio#120 |
I see, interesting. The v0.9.8.post1 does make the error go away in my app as expected |
Closing this issue now. If you come across any more problems, make a new issue. Thanks. |
Hi (it's me again... Thanks a lot for the last issue by the way !)
It seems not possible to create a websocket server, e.G. using python-socketio, on a child / dispatched app.
Is it expected behaviour ? Or am I doing it the wrong way ?
The error code happens in python-engineio but I think it comes from the dispatcher (it works fine when the socketio server is attached to the main app)
Here's the code to reproduce :
Requirements:
Server.py
client.py :
Error code when running server.py then connect.py :
Thanks a lot !
The text was updated successfully, but these errors were encountered: