diff --git a/app/utils/websocket_tool.py b/app/utils/websocket_tool.py index 84a83eb..8deb533 100644 --- a/app/utils/websocket_tool.py +++ b/app/utils/websocket_tool.py @@ -1,6 +1,8 @@ """ @Time : 2022/10/12 17:55 @Auth : 东 +@File :websocket_tool.py +@IDE :PyCharm @Motto:ABC(Always Be Coding) @Desc: @@ -14,15 +16,16 @@ from configs.global_var import * class WebsocketUtil: + def connect(self, ws, id: str): # 等待连接 msg = ws.receive() # 存储ws连接对象 - # global active_connections - # active_connections = get_active_connections() + global active_connections + active_connections = get_active_connections() active_connections.append(ws) - # global active_connections_dist - # active_connections_dist = get_active_connections_dist() + global active_connections_dist + active_connections_dist = get_active_connections_dist() if id in active_connections_dist: active_connections_dist[id].append(ws) else: @@ -60,4 +63,4 @@ class WebsocketUtil: self.disconnect(ws=connection, id=id) -manager = WebsocketUtil() +manager = WebsocketUtil() \ No newline at end of file