Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
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"
)
14
async
def
websocket(websocket: WebSocket):
15
await websocket.accept()
16
await websocket.send_json({
"msg"
:
"Hello WebSocket"
})
17
await websocket.close()
18
19
20
def
test_read_main():
Callers
nothing calls this directly
Calls
1
close
Method · 0.45
Tested by
no test coverage detected