MCPcopy Create free account
hub / github.com/encode/starlette / asgi

Function asgi

tests/test_testclient.py:277–287  ·  view source on GitHub ↗
(receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

275 await websocket.send_json({"message": "test"})
276
277 async def asgi(receive: Receive, send: Send) -> None:
278 websocket = WebSocket(scope, receive=receive, send=send)
279 await websocket.accept()
280 async with anyio.create_task_group() as task_group:
281 task_group.start_soon(respond, websocket)
282 try:
283 # this will block as the client does not send us data
284 # it should not prevent `respond` from executing though
285 await websocket.receive_json()
286 except WebSocketDisconnect:
287 pass
288
289 return asgi
290

Callers

nothing calls this directly

Calls 3

acceptMethod · 0.95
receive_jsonMethod · 0.95
WebSocketClass · 0.90

Tested by

no test coverage detected