MCPcopy
hub / github.com/encode/starlette / websocket_state

Function websocket_state

tests/test_applications.py:94–97  ·  view source on GitHub ↗
(websocket: WebSocket[CustomState])

Source from the content-addressed store, hash-verified

92
93
94async def websocket_state(websocket: WebSocket[CustomState]) -> None:
95 await websocket.accept()
96 await websocket.send_json({"count": websocket.state["count"]})
97 await websocket.close()
98
99
100def custom_ws_exception_handler(websocket: WebSocket, exc: CustomWSException) -> None:

Callers

nothing calls this directly

Calls 3

acceptMethod · 0.80
send_jsonMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected