Refactor of ZMQWebsocketHandler callback (closure -> method)

This commit is contained in:
Kristóf Tóth 2018-01-17 14:58:01 +01:00
parent 863cc304ad
commit 8ee658e62a

View File

@ -14,14 +14,13 @@ class ZMQWebSocketHandler(WebSocketHandler):
def open(self, *args, **kwargs):
logging.debug('WebSocket connection initiated')
event_handler_connector.register_callback(self.zmq_callback)
def zmq_callback(msg_parts):
def zmq_callback(self, msg_parts):
anchor, data = msg_parts
logging.debug('Received on pull socket: {}'.format(data.decode()))
self.write_message(data.decode())
event_handler_connector.register_callback(zmq_callback)
def on_message(self, message):
logging.debug('Received on WebSocket: {}'.format(message))
fsm.trigger(parse_anchor_from_message(message), message=message)