MCPcopy Index your code
hub / github.com/fastapi/fastapi / websocket

Function websocket

docs_src/app_testing/tutorial002_py310.py:14–17  ·  view source on GitHub ↗
(websocket: WebSocket)

Source from the content-addressed store, hash-verified

12
13@app.websocket("/ws")
14async def websocket(websocket: WebSocket):
15 await websocket.accept()
16 await websocket.send_json({"msg": "Hello WebSocket"})
17 await websocket.close()
18
19
20def test_read_main():

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected