def send_message(self, action, **data):
"""Sends the message to the connected client
"""
message = {
"action": action,
"data": data
}
try:
self.write_message(json.dumps(message))
except WebSocketClosedError:
logger.warning("WS_CLOSED", "Could Not send Message: " + json.dumps(message))
# Send Websocket Closed Error to Paired Opponent
self.send_pair_message(action="pair-closed")
self.close()
评论列表
文章目录