Skip to content
Discussion options

You must be logged in to vote

websocket_route doesn't take any body parameters. Websockets does.
This will resolve the issue:

@app.websocket("/ws/{x}/something")
async def websocket(websocket: WebSocket, x: str):
	await websocket.accept()
	await websocket.send_json({"msg": "Hello WebSocket"})
	await websocket.close()

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
Converted from issue

This discussion was converted from issue #2513 on February 28, 2023 17:15.