...
Once this is set up, you can receive messages using a snippet of code similar to this :
Code Block | ||
---|---|---|
| ||
# TODO!/usr/bin/env python import zmq context = zmq.Context() subscriber = context.socket(zmq.SUB) subscriber.connect("tcp://localhost:50002") subscriber.setsockopt(zmq.SUBSCRIBE, "") while True: string = subscriber.recv_json() print(string) |
Sending messages
There is a PULL socket waiting to receive message and inject them directly in the message bus. You can send message to the event bus by using a ZMQ PUSH socket like this:
...