yasuki_web.auth.user_for_websocket#

async user_for_websocket(websocket)[source]#

The user behind the session cookie on a WebSocket handshake, or None.

Browsers send the session cookie on the upgrade request, so the same cookie that authenticates HTTP routes also identifies the socket. The play surface needs a ready account, so a session that is unauthenticated, unnamed, or not-yet-approved yields None — the signal to close the handshake.