Closed paulm17 closed 9 years ago
Put a sleep before the first send. Give your subscriber time to subscribe. A publisher doesn't wait for subscribers. If there is no subscriber, the mesage is lost.
Please post questions on how to use ZeroMQ to the mailing list. http://zeromq.org/docs:mailing-lists
I figured it out.
func main() {
// Prepare our publisher
publisher, _ := zmq.NewSocket(zmq.PUB)
defer publisher.Close()
publisher.Bind("tcp://10.101.45.3:5563")
time.Sleep(time.Second * 5);
publisher.Send("B", zmq.SNDMORE)
publisher.Send("WTF! 1 ", 0)
publisher.Send("B", zmq.SNDMORE)
publisher.Send("WTF! 2 ", 0)
time.Sleep(time.Second * 5);
}
Seems it needs a wait before the first send and after the last send otherwise the send does not occur due to the socket closing!
Hi,
https://raw.githubusercontent.com/pebbe/zmq4/master/examples/psenvpub.go
I am unable to send messages without it being in a loop.
Only the messages in the loop get sent.