mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
13 lines
385 B
Python
13 lines
385 B
Python
import zmq
|
|
|
|
|
|
class ZMQPublisher:
|
|
def __init__(self, topic, feed_protocol, feed_addr, feed_port):
|
|
self.topic = topic
|
|
self.context = zmq.Context()
|
|
self.socket = self.context.socket(zmq.PUB)
|
|
self.socket.bind("%s://%s:%s" % (feed_protocol, feed_addr, feed_port))
|
|
|
|
def publish_data(self, data):
|
|
self.socket.send_multipart([self.topic, data])
|