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

Method on_connect

tests/test_endpoints.py:69–71  ·  view source on GitHub ↗
(self, websocket: WebSocket)

Source from the content-addressed store, hash-verified

67def test_websocket_endpoint_on_connect(test_client_factory: TestClientFactory) -> None:
68 class WebSocketApp(WebSocketEndpoint):
69 async def on_connect(self, websocket: WebSocket) -> None:
70 assert websocket["subprotocols"] == ["soap", "wamp"]
71 await websocket.accept(subprotocol="wamp")
72
73 client = test_client_factory(WebSocketApp)
74 with client.websocket_connect("/ws", subprotocols=["soap", "wamp"]) as websocket:

Callers

nothing calls this directly

Calls 1

acceptMethod · 0.80

Tested by

no test coverage detected