The middleware was calling the handler as a raw ASGI callable
(scope, receive, send), but websocket_endpoint expects (WebSocket, token).
This caused an AttributeError on every connection attempt, which made the
frontend hit its 30s exponential backoff cap and spam reconnects.
Fix: construct a WebSocket object from scope/receive/send and extract the
?token= query param before calling the handler, matching what FastAPI's
routing machinery would do.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>