def send(output): zmq_ctx = zmq.Context() c = zmq_ctx.socket(zmq.PUB) c.connect(output) while True: frame = (output).encode() c.send(frame, zmq.NOBLOCK) time.sleep(0.1)