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

Function websocket_session

tests/protocols/test_websocket.py:531–535  ·  view source on GitHub ↗
(url: str)

Source from the content-addressed store, hash-verified

529 break
530
531 async def websocket_session(url: str):
532 async with websockets.client.connect(url) as websocket:
533 await websocket.ping()
534 await websocket.send("abc")
535 await websocket.close(code=1001, reason="custom reason")
536
537 config = Config(app=app, ws=ws_protocol_cls, http=http_protocol_cls, lifespan="off", port=unused_tcp_port)
538 async with run_server(config):

Calls 4

wsresponseFunction · 0.85
pingMethod · 0.80
sendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected