def send_response(self, success, obj):
"""Send a response back to someone."""
resp_object = {'type': 'response', 'success': success}
if obj is not None:
resp_object['payload'] = obj
msg = msgpack.packb(resp_object, default=self.encode_datetime)
self.logger.debug("Sending response: %s", obj)
try:
self.write_message(msg, binary=True)
except tornado.websocket.WebSocketClosedError:
pass
评论列表
文章目录