Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, emit_addr, reg_addr):
"""
Initialize the events server.
:param emit_addr: The address in which to receive events from clients.
:type emit_addr: str
:param reg_addr: The address to which publish events to clients.
:type reg_addr: str
"""
TxZmqServerComponent.__init__(self)
# bind PULL and PUB sockets
self._pull, self.pull_port = self._zmq_bind(
txzmq.ZmqPullConnection, emit_addr)
self._pub, self.pub_port = self._zmq_bind(
txzmq.ZmqPubConnection, reg_addr)
# set a handler for arriving messages
self._pull.onPull = self._onPull
def startService(self):
factory = ZmqFactory()
log.msg("Listener connecting to broadcaster: %s" % ZMQ_PUSHER)
endpoint = ZmqEndpoint('connect', ZMQ_PUSHER)
self.conn = ZmqPullConnection(factory, endpoint)
self.conn.onPull = self._message_received
def startService(self):
factory = ZmqFactory()
bind_point = 'tcp://0.0.0.0:8051'
log.msg("Repeater binding on: %s" % bind_point)
endpoint = ZmqEndpoint('bind', bind_point)
self.conn = ZmqPullConnection(factory, endpoint)
self.conn.onPull = self._message_received