diff --git a/solara/server/server.py b/solara/server/server.py index 2233caf01..ccf834411 100644 --- a/solara/server/server.py +++ b/solara/server/server.py @@ -135,6 +135,10 @@ async def app_loop(ws: websocket.WebsocketWrapper, session_id: str, connection_i try: message = await ws.receive() except websocket.WebSocketDisconnect: + try: + context.kernel.session.websockets.remove(ws) + except KeyError: + pass logger.debug("Disconnected") return t0 = time.time()