diff --git a/lib/tfw/networking/server/zmq_websocket_proxy.py b/lib/tfw/networking/server/zmq_websocket_proxy.py index 6df7c9a..5ab0b10 100644 --- a/lib/tfw/networking/server/zmq_websocket_proxy.py +++ b/lib/tfw/networking/server/zmq_websocket_proxy.py @@ -14,6 +14,7 @@ LOG = logging.getLogger(__name__) class ZMQWebSocketProxy(WebSocketHandler): # pylint: disable=abstract-method instances = set() + sequence_number = 0 def initialize(self, **kwargs): # pylint: disable=arguments-differ self._event_handler_connector = kwargs['event_handler_connector'] @@ -59,14 +60,20 @@ class ZMQWebSocketProxy(WebSocketHandler): """ Invoked on ZMQ messages from event handlers. """ + self.sequence_message(message) LOG.debug('Received on pull socket: %s', message) self.proxy_eventhandler_to_websocket(message) + def sequence_message(self, message): + self.sequence_number += 1 + message['seq'] = self.sequence_number + def on_message(self, message): """ Invoked on WS messages from frontend. """ message = json.loads(message) + self.sequence_message(message) LOG.debug('Received on WebSocket: %s', message) self.proxy_websocket_to_eventhandler(message)