don't exit when client closes
This commit is contained in:
@@ -864,13 +864,17 @@ def websocketupdater():
|
||||
|
||||
def msg_to_websockets(typ: str, msg: str):
|
||||
jmsg = json.dumps({'type': typ, 'data': msg})
|
||||
to_close = []
|
||||
for ws in ws_connections:
|
||||
try:
|
||||
asyncio.run(ws.send(jmsg))
|
||||
except Exception as e:
|
||||
print("ws.send exception: %s" % e)
|
||||
exit(1)
|
||||
except Exception:
|
||||
to_close.append(ws)
|
||||
print("ws.send exception: closed")
|
||||
|
||||
for ws in to_close:
|
||||
ws.close()
|
||||
del ws_connections[ws]
|
||||
#
|
||||
# Main
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user