deepstream.io icon indicating copy to clipboard operation
deepstream.io copied to clipboard

Calling `record.unsubscribe()` does not remove all subscriptions

Open ChristophConrads-deepstreamHub opened this issue 9 years ago • 5 comments

Demo code:

According to the JavaScript client record documentation, unsubscribe should remove all callbacks:

Unsubscribe all callbacks not associated with a path:
user.unsubscribe()

I'm running into this one as well. Any ideas as to why it'd be happening?

PawkaHub avatar Jan 03 '17 01:01 PawkaHub

This is a client issue, it appears we are passing undefined into the off command and its doing a `.length' which makes it think that the path exists.

https://github.com/component/emitter/blob/187492ab8028c7221b589bdfd482b715149cd868/index.js#L89 https://github.com/deepstreamIO/deepstream.io-client-js/blob/master/src/record/record.js#L245

a = function(a,b) {
  console.log(arguments.length)
}
a('1')  // 1
a(undefined) // 1

Seems like a quick fix, we'll get it in the next release!

yasserf avatar Jan 03 '17 19:01 yasserf

This is broken for list.unsubscribe() (without callback specified) too:

list.unsubscribe

EnigmaCurry avatar Mar 13 '17 18:03 EnigmaCurry

This is fixed in v4. Closing.


You can test this using this script

derrandz avatar Dec 12 '17 15:12 derrandz