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

Function websocket_state

tests/test_applications.py:94–97  ·  tests/test_applications.py::websocket_state
(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({class="st">"count": websocket.state[class="st">"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