You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 4, 2024. It is now read-only.
socketio_path is incorrect in call to socketio.ASGIApp since FastAPI 0.109.0 / Stalette 0.33.0, breaking, well, everything #52
The default mounting point of /ws/socket.io no longer works correctly for quite some time now, because of this change to Starlette (which, apparently, is just following the ASGI spec): Kludex/starlette#2413 (reply in thread)
First, you will have noticed that your JavaScript code using socket.io gives lots of 404 errors (or 403 errors, perhaps) and you will have tried to fix them by doing this:
But, sadly, now you have another problem, which is a very large stacktrace on the server side with this in it:
RuntimeError: Expected ASGI message 'websocket.accept', 'websocket.close', or 'websocket.http.response.start' but got 'http.response.start'.
You have two choices, either you can downgrade to fastapi==0.108.0 (not recommended), or you can add a socketio_path argument to your SocketManager constructor:
This needs to be fixed in fastapi-socketio so that it passes the full path to socket.io (that is, prefixed with the mount location) in the ASGIApp constructor, and then fastapi-socketio needs to depend on at least the versions of FastAPI and Starlette mentioned above.
Since just joining mount_location and socketio_path will conflict with the workaround above, it would probably be a good idea to respect an absolute socketio_path if specified...
Activity
dhdaines commentedon Apr 4, 2024
This is probably the same issue as #51 and #48 and maybe others