From 92366f2662f52e550c84816b37a7bf3b9bad19e6 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 9 Aug 2023 14:37:39 +0200 Subject: [PATCH] server: fix websocket --- server/reflector/views/transcripts.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/reflector/views/transcripts.py b/server/reflector/views/transcripts.py index dabd2f9d..039201ec 100644 --- a/server/reflector/views/transcripts.py +++ b/server/reflector/views/transcripts.py @@ -211,8 +211,11 @@ class WebsocketManager: async def send_json(self, transcript_id: UUID, message): if transcript_id not in self.active_connections: return - for connection in self.active_connections[transcript_id]: - await connection.send_json(message) + for connection in self.active_connections[transcript_id][:]: + try: + await connection.send_json(message) + except Exception: + self.active_connections[transcript_id].remove(connection) ws_manager = WebsocketManager()