Closed n-of-one closed 5 years ago
Because this method was already present in the original library I forked.
Removing it would be a breaking change and I started this fork just for maintenance, not for major releases.
Hi @erikaadvisser, you are using the client.unsubscribe() method wrongly. The unsubscribe method accepts two args, the 'id' and the 'header':
unsubscribe(id, header={})
You are trying to unsubscribe using the destination.
So, both ways work:
const subscription = client.subscribe('/topic/scan/123');
...
client.unsubscribe(subscription.id);
const subscription = client.subscribe('/topic/scan/123');
...
subscription.unsubscribe();
The subscription 'unsubscribe' already bind the id arg for you.
Thanks for taking the time to clarify it, and include examples. It now makes sense to me again.
I encountered very strange (and buggy) behaviour when I ran:
This caused two messages to be sent. And every-time I unsubscribed and re-subscribed, an extra message gets sent when I call client.send() (so 2,3,4...)
The docs state:
And this indeed solved the issue. However, it still feels like a bug to me. Why not just remove the client.unsubscribe() function?