@nxtedition/deepstream.io-client-js 23.4.54 → 23.4.56

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.4.54",
3
+ "version": "23.4.56",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -129,7 +129,17 @@ Connection.prototype.send = function (message) {
129
129
  return false
130
130
  }
131
131
 
132
- return this._submit(message)
132
+ if (
133
+ this._state !== C.CONNECTION_STATE.OPEN ||
134
+ this._endpoint.readyState !== this._endpoint.OPEN
135
+ ) {
136
+ return false
137
+ }
138
+
139
+ this.emit('send', message)
140
+ this._endpoint.send(message)
141
+
142
+ return true
133
143
  }
134
144
 
135
145
  Connection.prototype._submit = function (message) {
@@ -139,10 +149,7 @@ Connection.prototype._submit = function (message) {
139
149
  const err = new Error(`Packet to big: ${message.length} > ${maxPacketSize}`)
140
150
  this._client._$onError(C.TOPIC.CONNECTION, C.EVENT.CONNECTION_ERROR, err)
141
151
  return false
142
- } else if (
143
- this._state === C.CONNECTION_STATE.OPEN &&
144
- this._endpoint.readyState === this._endpoint.OPEN
145
- ) {
152
+ } else if (this._endpoint.readyState === this._endpoint.OPEN) {
146
153
  this.emit('send', message)
147
154
  this._endpoint.send(message)
148
155
  return true