Note that there are some explanatory texts on larger screens.

plurals
  1. POZeroMQ PUB/SUB - why won't multiple subscribers work?
    primarykey
    data
    text
    <p>I'm using ZeroMQ to facilitate a publish/subscribe environment I'm needing. I'm running a publish server on machine A using Python (using EventLoop), and right now I have one subscriber running in C++ on machine B and a second subscriber running in Python (using EventLoop) on machine C.</p> <p>If machine B subscribes to machine A before machine C does, then B gets subscribed messages and C does not. Furthermore, if I look at the established connections on machine A, there only exists a connection for machine B but not for C. If machine C subscribes to A before B does, then it's the other way around.</p> <p>Here's my publisher code:</p> <pre><code>import zmq from zmq.eventloop import ioloop, zmqstream ioloop.install() context = zmq.Context(1) socket = context.socket(zmq.PUB) publisher = zmqstream.ZMQStream(socket) socket.bind("tcp://*:1337") def publish(): publisher.send_multipart(("heartbeat", "OHAI")) ioloop.PeriodicCallback(publish, 5000).start() ioloop.IOLoop.instance().start() </code></pre> <p>Here's my Python subscriber code:</p> <pre><code>import zmq from zmq.eventloop import ioloop, zmqstream ioloop.install() context = zmq.Context(1) socket = context.socket(zmq.SUB) subscriber = zmqstream.ZMQStream(socket) socket.setsockopt(zmq.SUBSCRIBE, "heartbeat") socket.connect("tcp://pub.local:1337") def subscription(message): print "Message Received: %s" % (message[1]) subscriber.on_recv(subscription) ioloop.IOLoop.instance().start() </code></pre> <p>Why isn't my publisher accepting multiple incoming subscriber sockets? It's probably worth noting that multiple subscribers works fine when running them on machine A, but I don't think it's a firewall issue because I tested subscriber connections from B and C to A with the firewall disabled.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload