全局变量
This commit is contained in:
parent
066fb720bc
commit
b60fa43567
@ -1,6 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
@Time : 2022/10/12 17:55
|
@Time : 2022/10/12 17:55
|
||||||
@Auth : 东
|
@Auth : 东
|
||||||
|
@File :websocket_tool.py
|
||||||
|
@IDE :PyCharm
|
||||||
@Motto:ABC(Always Be Coding)
|
@Motto:ABC(Always Be Coding)
|
||||||
@Desc:
|
@Desc:
|
||||||
|
|
||||||
@ -14,15 +16,16 @@ from configs.global_var import *
|
|||||||
|
|
||||||
class WebsocketUtil:
|
class WebsocketUtil:
|
||||||
|
|
||||||
|
|
||||||
def connect(self, ws, id: str):
|
def connect(self, ws, id: str):
|
||||||
# 等待连接
|
# 等待连接
|
||||||
msg = ws.receive()
|
msg = ws.receive()
|
||||||
# 存储ws连接对象
|
# 存储ws连接对象
|
||||||
# global active_connections
|
global active_connections
|
||||||
# active_connections = get_active_connections()
|
active_connections = get_active_connections()
|
||||||
active_connections.append(ws)
|
active_connections.append(ws)
|
||||||
# global active_connections_dist
|
global active_connections_dist
|
||||||
# active_connections_dist = get_active_connections_dist()
|
active_connections_dist = get_active_connections_dist()
|
||||||
if id in active_connections_dist:
|
if id in active_connections_dist:
|
||||||
active_connections_dist[id].append(ws)
|
active_connections_dist[id].append(ws)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user