mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-09 17:37:17 +00:00
19 lines
675 B
Python
19 lines
675 B
Python
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
|
# All Rights Reserved. See LICENSE file for details.
|
|
|
|
import zmq
|
|
from zmq.eventloop.zmqstream import ZMQStream
|
|
|
|
from tfw.config import TFWENV
|
|
from tfw.networking import ZMQConnectorBase
|
|
|
|
|
|
class ControllerConnector(ZMQConnectorBase):
|
|
def __init__(self, zmq_context=None):
|
|
super(ControllerConnector, self).__init__(zmq_context)
|
|
self._zmq_rep_socket = self._zmq_context.socket(zmq.REP)
|
|
self._zmq_rep_socket.connect(f'tcp://localhost:{TFWENV.CONTROLLER_PORT}')
|
|
self._zmq_rep_stream = ZMQStream(self._zmq_rep_socket)
|
|
|
|
self.register_callback = self._zmq_rep_stream.on_recv_stream
|