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 Aug 19, 2025. It is now read-only.
Sorry for the newbishness, I'm having trouble understanding how to use the project. Main points I struggle with:
Coming from FastAPI/WebSockets, the docs have Depends(...) injected to routes. They use fastapi.app.websocket rather than starlette.routing.WebSocketRoute. Wondering what the simple translation from Starlette->FastAPI is to allow Depends() in the functions?
If it's as simple as replacing WebSocketRoute("/", ...) with app.websocket("/"), where do I put my dependencies? Is it at the async def chatroom_ws(websocket, <add deps here>) level?
Where/how do I handle on_connect, on_disconnect?
What's going on with run_until_first_complete? I can't find documentation in Starlette, and when I dive into asyncio.wait(..., FIRST_COMPLETED) it seems to imply the first task to complete is solid, and what's left is cancelled? Which confuses me on the setup of receiver/sender, don't we want both?
Looking at all the above, fastapi-websocket-broadcast has a pretty solid kitchen-sink example of subclassing WebSocketEndpoint with on_connect|disconnect|message, keeping websockets around for later use, etc. Maybe a more robust broadcaster sample in /examples could be in order for us FastAPI newbies?