@nxtedition/deepstream.io-client-js 31.0.11 → 31.0.13

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": "31.0.11",
3
+ "version": "31.0.13",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -5,7 +5,7 @@ const SEP = C.MESSAGE_PART_SEPERATOR
5
5
 
6
6
  let poolBuf
7
7
  let poolPos = 0
8
- let poolSize = 1024 * 1024
8
+ let poolSize = 2 * 1024 * 1024
9
9
 
10
10
  export function getMsg(topic, action, data, binary) {
11
11
  if (data && !(data instanceof Array)) {
@@ -30,10 +30,10 @@ export function getMsg(topic, action, data, binary) {
30
30
  headerSize += 2
31
31
 
32
32
  estimatedSize += headerSize + topic.length + action.length + 2 // +2 for the topic and action separators
33
- estimatedSize += 32 // Allow for some extra space
34
33
  }
35
34
 
36
- if (!poolBuf || poolBuf.byteLength - poolPos < estimatedSize) {
35
+ if (!poolBuf || poolBuf.byteLength - poolPos < estimatedSize * 2) {
36
+ poolSize = Math.max(poolSize, estimatedSize * 2)
37
37
  poolBuf = Buffer.allocUnsafeSlow(poolSize)
38
38
  poolPos = 0
39
39
  }