@nxtedition/deepstream.io-client-js 23.3.3 → 23.3.5

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": "23.3.3",
3
+ "version": "23.3.5",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
package/src/client.js CHANGED
@@ -71,7 +71,11 @@ Client.prototype.getConnectionState = function () {
71
71
 
72
72
  Client.prototype._$onMessage = function (message) {
73
73
  if (this._messageCallbacks[message.topic]) {
74
- this._messageCallbacks[message.topic](message)
74
+ try {
75
+ this._messageCallbacks[message.topic](message)
76
+ } catch (err) {
77
+ this._$onError(message.topic, null, err, message.data.slice(0))
78
+ }
75
79
  } else {
76
80
  message.processedError = true
77
81
  this._$onError(
@@ -94,7 +98,9 @@ Client.prototype._$onError = function (topic, event, msgOrError, data) {
94
98
 
95
99
  if (this.hasListeners('error')) {
96
100
  this.emit('error', error)
97
- this.emit(event, error)
101
+ if (event) {
102
+ this.emit(event, error)
103
+ }
98
104
  } else {
99
105
  console.log('--- You can catch all deepstream errors by subscribing to the error event ---')
100
106
 
@@ -87,6 +87,9 @@ class Listener {
87
87
  this._error(name, err)
88
88
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
89
89
  },
90
+ complete: () => {
91
+ this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
92
+ },
90
93
  })
91
94
  this._subscriptions.set(name, subscription)
92
95
  } else {