This commit is contained in:
JIAKUNHAO 2022-11-24 17:24:11 +08:00
parent 2314b931b5
commit ea84ec400e

View File

@ -27,6 +27,12 @@ class WebsocketUtil:
def connect(self, ws, id: str):
p1 = Persons(1)
p2 = Persons(2)
write(id="123", ws=[p1, p2])
ps = read(id="123")
ps[0].say()
print(ps[1].dict)
# 等待连接
msg = ws.receive()
# 存储ws连接对象
@ -89,3 +95,14 @@ def read(id: str):
f.close()
print(f"反序列化对象{wss}")
return wss
class Persons():
def __init__(self, x) -> None:
self.dict = {
"1": 111 * x,
"2": 222 * x
}
def say(self):
self.dict[3] = "333"