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

Function handler

example/django/authentication.py:14–21  ·  view source on GitHub ↗
(websocket)

Source from the content-addressed store, hash-verified

12
13
14async def handler(websocket):
15 sesame = await websocket.recv()
16 user = await asyncio.to_thread(get_user, sesame)
17 if user is None:
18 await websocket.close(CloseCode.INTERNAL_ERROR, "authentication failed")
19 return
20
21 await websocket.send(f"Hello {user}!")
22
23
24async def main():

Callers

nothing calls this directly

Calls 3

recvMethod · 0.45
closeMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…