Closed khan-07 closed 4 years ago
Actually my bad, i was doing in this in the callback of the subscribe wrapper i wrote. That was really stupid of me. It was receiving just one message but printing multiple because multiple callbacks were being triggered(one for each subscribe).
device.on('message', function(topic, payload) {
console.log('Message received from server on topic ', topic, payload.toString());
});
Hi,
Hope you are good. I have a very simple task of subscribing to a topic , unsubscribing and resubcribing at some later time. But the client remains active during that duration. My architecture doesn't allows me to create multiple devices so i want to reuse the same device. When i unsubscibe the data stream stops correctly but upon resubscribing i start getting same message twice(or the amount of times i call unsubcribe/subscribe). This is a small test code for replicating the issue
Help would be really appreciated.