def offline(websocket): v = str(websocket.__hash__()) websocket.close() del gWebSocketsMap[v]
def online(websocket): if websocket and not websocket.closed: v = str(websocket.__hash__()) if not v in gWebSocketsMap: gWebSocketsMap[v] = websocket