diff --git a/jupyter/stock.py b/jupyter/stock.py index 9f5aeaf..9d0ac65 100644 --- a/jupyter/stock.py +++ b/jupyter/stock.py @@ -771,7 +771,8 @@ class WebServer: if not session_id in self.sessions: self.generate_session(ws, session_id) - self.sessions[session_id]['sockets'].append(ws) + if ws not in self.sessions[session_id]['sockets']: + self.sessions[session_id]['sockets'].append(ws) while True: try: @@ -837,6 +838,7 @@ class WebServer: self.sessions[session_id]['sockets'].remove(ws) for socket in self.sessions[session_id]['sockets']: socket.send(json.dumps({"type": "users", "update": self.sessions[session_id]['users']})) + return # Serve React app - This catches all routes not matched by API endpoints @self.app.route('/')