Browse Source

Fix issue when websocket is deleted when data is being sent.

pull/1977/merge
comfyanonymous 11 months ago
parent
commit
8e2c99e3cf
  1. 6
      server.py

6
server.py

@ -584,7 +584,8 @@ class PromptServer():
message = self.encode_bytes(event, data) message = self.encode_bytes(event, data)
if sid is None: if sid is None:
for ws in self.sockets.values(): sockets = list(self.sockets.values())
for ws in sockets:
await send_socket_catch_exception(ws.send_bytes, message) await send_socket_catch_exception(ws.send_bytes, message)
elif sid in self.sockets: elif sid in self.sockets:
await send_socket_catch_exception(self.sockets[sid].send_bytes, message) await send_socket_catch_exception(self.sockets[sid].send_bytes, message)
@ -593,7 +594,8 @@ class PromptServer():
message = {"type": event, "data": data} message = {"type": event, "data": data}
if sid is None: if sid is None:
for ws in self.sockets.values(): sockets = list(self.sockets.values())
for ws in sockets:
await send_socket_catch_exception(ws.send_json, message) await send_socket_catch_exception(ws.send_json, message)
elif sid in self.sockets: elif sid in self.sockets:
await send_socket_catch_exception(self.sockets[sid].send_json, message) await send_socket_catch_exception(self.sockets[sid].send_json, message)

Loading…
Cancel
Save