@nxtedition/deepstream.io-client-js 24.1.4 → 24.1.6
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
|
@@ -325,6 +325,7 @@ Connection.prototype._setState = function (state) {
|
|
|
325
325
|
this.emit(C.EVENT.CONNECTED, true)
|
|
326
326
|
this._client.emit(C.EVENT.CONNECTED, true)
|
|
327
327
|
} else if (state === C.CONNECTION_STATE.RECONNECTING || state === C.CONNECTION_STATE.CLOSED) {
|
|
328
|
+
this._recvQueue = new FixedQueue()
|
|
328
329
|
this.emit(C.EVENT.CONNECTED, false)
|
|
329
330
|
this._client.emit(C.EVENT.CONNECTED, false)
|
|
330
331
|
}
|
|
@@ -36,13 +36,10 @@ class Listener {
|
|
|
36
36
|
this._handler = handler
|
|
37
37
|
this._client = this._handler._client
|
|
38
38
|
this._connection = this._handler._connection
|
|
39
|
+
this._listening = false
|
|
39
40
|
this._subscriptions = new Map()
|
|
40
41
|
|
|
41
|
-
this.
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get connected() {
|
|
45
|
-
return this._connection.connected
|
|
42
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN, [this._pattern, 'U'])
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
get stats() {
|
|
@@ -53,23 +50,9 @@ class Listener {
|
|
|
53
50
|
|
|
54
51
|
_$destroy() {
|
|
55
52
|
this._reset()
|
|
56
|
-
|
|
57
|
-
if (this.connected) {
|
|
58
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.UNLISTEN, [this._pattern])
|
|
59
|
-
}
|
|
60
53
|
}
|
|
61
54
|
|
|
62
55
|
_$onMessage(message) {
|
|
63
|
-
if (!this.connected) {
|
|
64
|
-
this._client._$onError(
|
|
65
|
-
C.TOPIC.RECORD,
|
|
66
|
-
C.EVENT.NOT_CONNECTED,
|
|
67
|
-
new Error('received message while not connected'),
|
|
68
|
-
message
|
|
69
|
-
)
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
56
|
const name = message.data[1]
|
|
74
57
|
|
|
75
58
|
if (message.action === C.ACTIONS.LISTEN_ACCEPT) {
|
|
@@ -100,12 +83,12 @@ class Listener {
|
|
|
100
83
|
error: (err) => {
|
|
101
84
|
this._error(name, err)
|
|
102
85
|
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
|
|
86
|
+
this._subscriptions.delete(name)
|
|
103
87
|
},
|
|
104
88
|
})
|
|
105
89
|
this._subscriptions.set(name, subscription)
|
|
106
90
|
} else {
|
|
107
91
|
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
|
|
108
|
-
this._subscriptions.delete(name)
|
|
109
92
|
}
|
|
110
93
|
} else if (message.action === C.ACTIONS.LISTEN_REJECT) {
|
|
111
94
|
const subscription = this._subscriptions.get(name)
|
|
@@ -122,8 +105,8 @@ class Listener {
|
|
|
122
105
|
return true
|
|
123
106
|
}
|
|
124
107
|
|
|
125
|
-
_$onConnectionStateChange() {
|
|
126
|
-
if (
|
|
108
|
+
_$onConnectionStateChange(connected) {
|
|
109
|
+
if (connected) {
|
|
127
110
|
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN, [this._pattern, 'U'])
|
|
128
111
|
} else {
|
|
129
112
|
this._reset()
|
|
@@ -136,9 +119,11 @@ class Listener {
|
|
|
136
119
|
|
|
137
120
|
_reset() {
|
|
138
121
|
for (const subscription of this._subscriptions.values()) {
|
|
139
|
-
subscription
|
|
122
|
+
subscription.unsubscribe()
|
|
140
123
|
}
|
|
141
124
|
this._subscriptions.clear()
|
|
125
|
+
|
|
126
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.UNLISTEN, [this._pattern])
|
|
142
127
|
}
|
|
143
128
|
}
|
|
144
129
|
|