Skip to content

Instantly share code, notes, and snippets.

@saghul
Created June 25, 2011 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saghul/1046938 to your computer and use it in GitHub Desktop.
Save saghul/1046938 to your computer and use it in GitHub Desktop.
ZeroMQ consumer example
# consumer
import zmq
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.bind('tcp://127.0.0.1:5000')
socket.setsockopt(zmq.SUBSCRIBE, 'test')
socket.setsockopt(zmq.SUBSCRIBE, 'topic_1')
while True:
data = socket.recv()
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment