ws
This commit is contained in:
parent
2314b931b5
commit
ea84ec400e
@ -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连接对象
|
||||
@ -88,4 +94,15 @@ def read(id: str):
|
||||
print(wss)
|
||||
f.close()
|
||||
print(f"反序列化对象{wss}")
|
||||
return 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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user