This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Description
I know a way to have a dynamic channel by having chatroom id in URL, /ws/{chat_id}
I want to send {'type': 'subscribe', 'chat_id': 'dsfjkhdskjfhdskjhfkjdsahfa'}
@app.websocket("/ws")
async def ws_manager(websocket: WebSocket):
await websocket.accept()
async for message in websocket.iter_json():
if message['type'] == 'subscribe':
chat_id = message['chat_id']
async with broadcast.subscribe(channel=chat_id) as subscriber:
async for event in subscriber:
await websocket.send_text(event.message)
how can i have multiple subscriber for same socket connection?