You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
617 B

import zmq
import random
import sys
import time
import hugvey.communication
import coloredlogs, logging
coloredlogs.install(
level=logging.DEBUG
)
port = "5555"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.connect("tcp://127.0.0.1:%s" % port)
while True:
# topic = random.randrange(9999,10005)
# topic = "hv" + str(random.randrange(1,3))
messagedata = str(time.time())
# print ("{} {}".format(topic, messagedata))
hugvey.communication.zmqSend(socket, random.randrange(1,3), messagedata)
time.sleep(1)