[zeromq-dev] 0MQ subscription never ends?

tomb18 at videotron.ca tomb18 at videotron.ca
Sun Mar 16 23:39:18 CET 2014


Hi I am using 0MQ to receive a JSON message from a website. I am able to connect and retrieve messages with no problem. The problem is that even though I think I close down everything correctly where I am done, the next time I connect I get all the messages from the last time I connected! In this particular case, the messages are real time and there can be a few each second. So if I disconnect for a few days, I will receive thousands of messages next time I connect. I do not want that. I only want the messages to start when I connect. Does anyone know where I am going wrong?

Here is the code that I am using to connect and subscribe:

 using (var context = ZmqContext.Create()) { using (var socket = context.CreateSocket(SocketType.SUB)) { socket.SubscribeAll(); socket.Connect("tcp://clublog.org:7373"); var spot = socket.Receive(Encoding.UTF8); 

Everything works fine. When I close the application I issue

 socket.UnsubscribeAll(); socket.Close(); context.Terminate(); 

I guess I must be doing something wrong. But even more troublesome...shouldn't the server stop keeping track of the messages I want if I disconnect?




Thanks for any help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140316/db451d71/attachment.htm>


More information about the zeromq-dev mailing list