@nxtedition/deepstream.io-client-js 24.1.6 → 24.1.8
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 +1 -1
- package/src/message/connection.js +11 -0
package/package.json
CHANGED
|
@@ -9,6 +9,8 @@ const xxhash = require('xxhash-wasm')
|
|
|
9
9
|
const FixedQueue = require('../utils/fixed-queue')
|
|
10
10
|
const Emitter = require('component-emitter2')
|
|
11
11
|
|
|
12
|
+
const kCorked = Symbol('corked')
|
|
13
|
+
|
|
12
14
|
const Connection = function (client, url, options) {
|
|
13
15
|
this._client = client
|
|
14
16
|
this._options = options
|
|
@@ -136,6 +138,15 @@ Connection.prototype.send = function (message) {
|
|
|
136
138
|
return false
|
|
137
139
|
}
|
|
138
140
|
|
|
141
|
+
if (this._endpoint._socket && !this._endpoint[kCorked]) {
|
|
142
|
+
this._endpoint._socket.cork()
|
|
143
|
+
this._endpoint[kCorked] = true
|
|
144
|
+
queueMicrotask(() => {
|
|
145
|
+
this._endpoint[kCorked] = false
|
|
146
|
+
this._endpoint._socket.uncork()
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
139
150
|
this.emit('send', message)
|
|
140
151
|
this._endpoint.send(message)
|
|
141
152
|
|