feat(websocket): multiplex multiple chat_ids over a single connection

This commit is contained in:
Xubin Ren
2026-04-18 16:49:12 +08:00
committed by Xubin Ren
parent 70a1279b86
commit 6bfb75ed03
5 changed files with 457 additions and 36 deletions
+2 -1
View File
@@ -290,10 +290,11 @@ async def test_disconnected_client_cleanup(bus: MagicMock) -> None:
async with WsTestClient("ws://127.0.0.1:29914/", client_id="tmp") as c:
chat_id = (await c.recv_ready()).chat_id
# disconnected
await asyncio.sleep(0.1)
await ch.send(OutboundMessage(
channel="websocket", chat_id=chat_id, content="orphan",
))
assert chat_id not in ch._connections
assert chat_id not in ch._subs
finally:
await ch.stop(); await t