@nxtedition/deepstream.io-client-js 24.1.3 → 24.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "24.1.3",
3
+ "version": "24.1.4",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -13,7 +13,7 @@ class Listener {
13
13
  this._recursive = recursive
14
14
  this._stringify = stringify || JSON.stringify
15
15
 
16
- this._$onConnectionStateChange(this._connection.connected)
16
+ this._$onConnectionStateChange()
17
17
  }
18
18
 
19
19
  get connected() {
@@ -209,8 +209,8 @@ class Listener {
209
209
  return true
210
210
  }
211
211
 
212
- _$onConnectionStateChange(connected) {
213
- if (connected) {
212
+ _$onConnectionStateChange() {
213
+ if (this.connected) {
214
214
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN, [this._pattern])
215
215
  } else {
216
216
  this._reset()
@@ -38,7 +38,7 @@ class Listener {
38
38
  this._connection = this._handler._connection
39
39
  this._subscriptions = new Map()
40
40
 
41
- this._$onConnectionStateChange(this._connection.connected)
41
+ this._$onConnectionStateChange()
42
42
  }
43
43
 
44
44
  get connected() {
@@ -90,8 +90,8 @@ class Listener {
90
90
  next: (data) => {
91
91
  if (data == null) {
92
92
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
93
+ this._subscriptions.delete(name)
93
94
  subscription.unsubscribe()
94
- this._subscriptions.set(name, null)
95
95
  } else {
96
96
  const version = `INF-${this._connection.hasher.h64ToString(data)}`
97
97
  this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [name, version, data])
@@ -105,27 +105,25 @@ class Listener {
105
105
  this._subscriptions.set(name, subscription)
106
106
  } else {
107
107
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
108
- this._subscriptions.set(name, null)
108
+ this._subscriptions.delete(name)
109
109
  }
110
110
  } else if (message.action === C.ACTIONS.LISTEN_REJECT) {
111
- if (!this._subscriptions.has(name)) {
112
- this._error(name, 'invalid remove: listener missing')
113
- return
114
- }
115
-
116
111
  const subscription = this._subscriptions.get(name)
117
112
 
118
- subscription?.unsubscribe()
119
-
120
- this._subscriptions.delete(name)
113
+ if (subscription) {
114
+ this._subscriptions.delete(name)
115
+ subscription.unsubscribe()
116
+ } else {
117
+ this._error(name, 'invalid remove: listener missing')
118
+ }
121
119
  } else {
122
120
  return false
123
121
  }
124
122
  return true
125
123
  }
126
124
 
127
- _$onConnectionStateChange(connected) {
128
- if (connected) {
125
+ _$onConnectionStateChange() {
126
+ if (this.connected) {
129
127
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN, [this._pattern, 'U'])
130
128
  } else {
131
129
  this._reset()