MCPcopy
hub / github.com/encode/uvicorn / get_connected_ws_protocol

Function get_connected_ws_protocol

tests/benchmarks/ws.py:33–40  ·  view source on GitHub ↗
(config: Config, ws_protocol_cls: WSProtocolClass)

Source from the content-addressed store, hash-verified

31
32
33def get_connected_ws_protocol(config: Config, ws_protocol_cls: WSProtocolClass) -> Any:
34 loop = MockLoop()
35 transport = MockTransport()
36 lifespan = LifespanOff(config)
37 server_state = ServerState()
38 protocol = ws_protocol_cls(config=config, server_state=server_state, app_state=lifespan.state, _loop=loop) # type: ignore[arg-type]
39 protocol.connection_made(transport) # type: ignore[arg-type]
40 return protocol

Callers 2

test_bench_ws_handshakeFunction · 0.90
test_bench_ws_send_textFunction · 0.90

Calls 6

MockLoopClass · 0.90
MockTransportClass · 0.90
LifespanOffClass · 0.90
ServerStateClass · 0.90
ws_protocol_clsFunction · 0.85
connection_madeMethod · 0.45

Tested by 2

test_bench_ws_handshakeFunction · 0.72
test_bench_ws_send_textFunction · 0.72