cleanup SSL handling
This commit is contained in:
@@ -855,22 +855,22 @@ async def ws_serve(websocket, path):
|
||||
except (
|
||||
websockets.exceptions.ConnectionClosedOK,
|
||||
websockets.exceptions.ConnectionClosedError) as e:
|
||||
print(f'ws closed: {e}')
|
||||
if verbose: print(f'ws closed: {e}')
|
||||
break
|
||||
print(f"< {name} at {path}")
|
||||
if verbose: print(f"initial {name} at {path}")
|
||||
# send initial set of hosts and messages
|
||||
# hosts in sorted order
|
||||
for h in sorted(hbdclass.Host.hosts):
|
||||
jmsg = json.dumps({'type': 'host', 'data': hbdclass.Host.hosts[h].stateinfo() })
|
||||
await websocket.send(jmsg)
|
||||
# messages in reverse order
|
||||
for m in msgs[len(msgs)-20:]:
|
||||
jmsg = json.dumps({'type': 'message', 'data': m })
|
||||
await websocket.send(jmsg)
|
||||
|
||||
if verbose: print(f"DBG ws_serve: close {remote_address}")
|
||||
await websocket.wait_closed()
|
||||
# try:
|
||||
# del ws_connections[websocket]
|
||||
# except Exception as e:
|
||||
# print(f"warning: failed to delete websocket: {e}")
|
||||
|
||||
|
||||
def websocketupdater():
|
||||
loop.run_forever()
|
||||
|
||||
Reference in New Issue
Block a user