Closed staier closed 8 years ago
@staier oldsubscription
returns a promise that resolves with the WAMP Subscription
, so you'll need to wait until oldsubscription
resolves before you can unsubscribe:
var oldsubscription = $wamp.subscribe('xxxx', func);
oldsubscription.then(function (s) {
$wamp.unsubscribe(s);
});
Thanks for the clarification. However i think this pattern is somewhat too complex. to really unsubscribe i need to create another promise that will call unsubscribe sometime in future, when i do not need it anymore. This is just a thought though.
Another issue is documentation. I believe the issue could be dismissed now. Thanks again.
The code is like this :
that gives an error "subscription.unsubscribe is not a function".
$wamp.unsubscribe(oldsubscription.$$state.value)
does not give an error. not sure it is correct usage however.Am i missing something? Please clarify. IMHO it is a bug.