MCPcopy Index your code
hub / github.com/python-websockets/websockets / first_message_handler

Function first_message_handler

experiments/authentication/app.py:111–120  ·  view source on GitHub ↗

Handler that sends credentials in the first WebSocket message.

(websocket)

Source from the content-addressed store, hash-verified

109
110
111async def first_message_handler(websocket):
112 """Handler that sends credentials in the first WebSocket message."""
113 token = await websocket.recv()
114 user = get_user(token)
115 if user is None:
116 await websocket.close(CloseCode.INTERNAL_ERROR, "authentication failed")
117 return
118
119 websocket.username = user
120 await handler(websocket)
121
122
123async def query_param_auth(connection, request):

Callers

nothing calls this directly

Calls 4

get_userFunction · 0.85
handlerFunction · 0.70
recvMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…