mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-01-07 16:34:28 +01:00
Refactors test structure
This commit is contained in:
12
test/simulator/zmq_publisher.py
Normal file
12
test/simulator/zmq_publisher.py
Normal file
@@ -0,0 +1,12 @@
|
||||
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])
|
||||
Reference in New Issue
Block a user