Open alex198211 opened 6 years ago
Should I do mychannel.off() after publishing? or will .unsubscribe do that? Can't seem to figure it out from the docs.
This is an old question, but I ran into this issue and solved it. So maybe others can benefit from my answer.
I would suggest using mychannel.isSubscribed()
(https://socketcluster.io/#!/docs/api-scchannel-client).
If you are in dev mode (with hot-reload) mychannel.on('subscribe'...
is going to be run each time and you will end up with several calls.
if (!mychannel.isSubscribed()) {
mychannel.on('subscribe', function(){
// content
});
}
Hello,
I have this code:
The payload is a string like "UPDATE;;995502044;;1.65;;2.65;;276" that I split.
Whenever that code is triggered it sends some of the previous messages, for example if I try to send this payload "UPDATE;;995502044;;0.00;;15.00;;276" it logs this:
It's basically re-sending the whole message history for some reason.
Am I doing something wrong?