iosignal 5.1.2 → 5.1.4
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/dist/io.js +1 -1
- package/dist/io.js.map +1 -1
- package/dist/io.min.js +1 -1
- package/dist/io.min.js.map +1 -1
- package/dist/iosignal.cjs +9806 -0
- package/dist/iosignal.js +503 -40
- package/package.json +11 -11
- package/rollup.config.js +8 -1
- package/LICENSE +0 -21
- package/README.md +0 -78
- package/test/attach-services/RedisService.js +0 -46
- package/test/attach-services/replyService.js +0 -46
- package/test/auth_server_client/auth_server_client.js +0 -45
- package/test/pubsub-counter/pubsub-counter.js +0 -61
- package/test/subscribe-signal/cid-a-b.js +0 -94
- package/test/subscribe-signal/cs-signal-test.js +0 -47
- package/test/subscribe-signal/meta.js +0 -61
- package/test/subscribe-signal/self-listen.js +0 -40
- package/test/subscribe-signal/self-subscribe.js +0 -35
- package/test/subscribe-signal/signal-MBA.js +0 -15
- package/test/subscribe-signal/signalPack.js +0 -34
- package/test/subscribe-signal/signaling.js +0 -61
package/dist/iosignal.js
CHANGED
|
@@ -2,18 +2,19 @@ import require$$0$2, { Transform } from 'stream';
|
|
|
2
2
|
import net from 'net';
|
|
3
3
|
import require$$0$3 from 'events';
|
|
4
4
|
import require$$1$1 from 'https';
|
|
5
|
-
import require$$2 from 'http';
|
|
5
|
+
import require$$2$2 from 'http';
|
|
6
6
|
import require$$4 from 'tls';
|
|
7
7
|
import require$$1 from 'crypto';
|
|
8
8
|
import require$$7 from 'url';
|
|
9
9
|
import require$$0 from 'zlib';
|
|
10
|
-
import require$$0$1 from 'buffer';
|
|
11
|
-
import { networkInterfaces } from 'os';
|
|
12
10
|
import fs, { readFileSync } from 'fs';
|
|
13
|
-
import { memoryUsage } from 'process';
|
|
14
11
|
import path from 'path';
|
|
12
|
+
import require$$2, { networkInterfaces } from 'os';
|
|
13
|
+
import require$$0$1 from 'buffer';
|
|
14
|
+
import require$$2$1 from 'util';
|
|
15
|
+
import { memoryUsage } from 'process';
|
|
15
16
|
|
|
16
|
-
var version$1 = "5.1.
|
|
17
|
+
var version$1 = "5.1.4";
|
|
17
18
|
var pkg = {
|
|
18
19
|
version: version$1};
|
|
19
20
|
|
|
@@ -2180,6 +2181,7 @@ function requireConstants () {
|
|
|
2180
2181
|
|
|
2181
2182
|
constants = {
|
|
2182
2183
|
BINARY_TYPES,
|
|
2184
|
+
CLOSE_TIMEOUT: 30000,
|
|
2183
2185
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
2184
2186
|
GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
|
|
2185
2187
|
hasBlob,
|
|
@@ -2192,6 +2194,300 @@ function requireConstants () {
|
|
|
2192
2194
|
return constants;
|
|
2193
2195
|
}
|
|
2194
2196
|
|
|
2197
|
+
var bufferutil = {exports: {}};
|
|
2198
|
+
|
|
2199
|
+
function commonjsRequire(path) {
|
|
2200
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
var nodeGypBuild$1 = {exports: {}};
|
|
2204
|
+
|
|
2205
|
+
var nodeGypBuild;
|
|
2206
|
+
var hasRequiredNodeGypBuild$1;
|
|
2207
|
+
|
|
2208
|
+
function requireNodeGypBuild$1 () {
|
|
2209
|
+
if (hasRequiredNodeGypBuild$1) return nodeGypBuild;
|
|
2210
|
+
hasRequiredNodeGypBuild$1 = 1;
|
|
2211
|
+
var fs$1 = fs;
|
|
2212
|
+
var path$1 = path;
|
|
2213
|
+
var os = require$$2;
|
|
2214
|
+
|
|
2215
|
+
// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression'
|
|
2216
|
+
var runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : commonjsRequire; // eslint-disable-line
|
|
2217
|
+
|
|
2218
|
+
var vars = (process.config && process.config.variables) || {};
|
|
2219
|
+
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
2220
|
+
var abi = process.versions.modules; // TODO: support old node where this is undef
|
|
2221
|
+
var runtime = isElectron() ? 'electron' : (isNwjs() ? 'node-webkit' : 'node');
|
|
2222
|
+
|
|
2223
|
+
var arch = process.env.npm_config_arch || os.arch();
|
|
2224
|
+
var platform = process.env.npm_config_platform || os.platform();
|
|
2225
|
+
var libc = process.env.LIBC || (isAlpine(platform) ? 'musl' : 'glibc');
|
|
2226
|
+
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || '';
|
|
2227
|
+
var uv = (process.versions.uv || '').split('.')[0];
|
|
2228
|
+
|
|
2229
|
+
nodeGypBuild = load;
|
|
2230
|
+
|
|
2231
|
+
function load (dir) {
|
|
2232
|
+
return runtimeRequire(load.resolve(dir))
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
load.resolve = load.path = function (dir) {
|
|
2236
|
+
dir = path$1.resolve(dir || '.');
|
|
2237
|
+
|
|
2238
|
+
try {
|
|
2239
|
+
var name = runtimeRequire(path$1.join(dir, 'package.json')).name.toUpperCase().replace(/-/g, '_');
|
|
2240
|
+
if (process.env[name + '_PREBUILD']) dir = process.env[name + '_PREBUILD'];
|
|
2241
|
+
} catch (err) {}
|
|
2242
|
+
|
|
2243
|
+
if (!prebuildsOnly) {
|
|
2244
|
+
var release = getFirst(path$1.join(dir, 'build/Release'), matchBuild);
|
|
2245
|
+
if (release) return release
|
|
2246
|
+
|
|
2247
|
+
var debug = getFirst(path$1.join(dir, 'build/Debug'), matchBuild);
|
|
2248
|
+
if (debug) return debug
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
var prebuild = resolve(dir);
|
|
2252
|
+
if (prebuild) return prebuild
|
|
2253
|
+
|
|
2254
|
+
var nearby = resolve(path$1.dirname(process.execPath));
|
|
2255
|
+
if (nearby) return nearby
|
|
2256
|
+
|
|
2257
|
+
var target = [
|
|
2258
|
+
'platform=' + platform,
|
|
2259
|
+
'arch=' + arch,
|
|
2260
|
+
'runtime=' + runtime,
|
|
2261
|
+
'abi=' + abi,
|
|
2262
|
+
'uv=' + uv,
|
|
2263
|
+
armv ? 'armv=' + armv : '',
|
|
2264
|
+
'libc=' + libc,
|
|
2265
|
+
'node=' + process.versions.node,
|
|
2266
|
+
process.versions.electron ? 'electron=' + process.versions.electron : '',
|
|
2267
|
+
typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line
|
|
2268
|
+
].filter(Boolean).join(' ');
|
|
2269
|
+
|
|
2270
|
+
throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n')
|
|
2271
|
+
|
|
2272
|
+
function resolve (dir) {
|
|
2273
|
+
// Find matching "prebuilds/<platform>-<arch>" directory
|
|
2274
|
+
var tuples = readdirSync(path$1.join(dir, 'prebuilds')).map(parseTuple);
|
|
2275
|
+
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
2276
|
+
if (!tuple) return
|
|
2277
|
+
|
|
2278
|
+
// Find most specific flavor first
|
|
2279
|
+
var prebuilds = path$1.join(dir, 'prebuilds', tuple.name);
|
|
2280
|
+
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
2281
|
+
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
2282
|
+
var winner = candidates.sort(compareTags(runtime))[0];
|
|
2283
|
+
if (winner) return path$1.join(prebuilds, winner.file)
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2287
|
+
function readdirSync (dir) {
|
|
2288
|
+
try {
|
|
2289
|
+
return fs$1.readdirSync(dir)
|
|
2290
|
+
} catch (err) {
|
|
2291
|
+
return []
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
function getFirst (dir, filter) {
|
|
2296
|
+
var files = readdirSync(dir).filter(filter);
|
|
2297
|
+
return files[0] && path$1.join(dir, files[0])
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
function matchBuild (name) {
|
|
2301
|
+
return /\.node$/.test(name)
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
function parseTuple (name) {
|
|
2305
|
+
// Example: darwin-x64+arm64
|
|
2306
|
+
var arr = name.split('-');
|
|
2307
|
+
if (arr.length !== 2) return
|
|
2308
|
+
|
|
2309
|
+
var platform = arr[0];
|
|
2310
|
+
var architectures = arr[1].split('+');
|
|
2311
|
+
|
|
2312
|
+
if (!platform) return
|
|
2313
|
+
if (!architectures.length) return
|
|
2314
|
+
if (!architectures.every(Boolean)) return
|
|
2315
|
+
|
|
2316
|
+
return { name, platform, architectures }
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
function matchTuple (platform, arch) {
|
|
2320
|
+
return function (tuple) {
|
|
2321
|
+
if (tuple == null) return false
|
|
2322
|
+
if (tuple.platform !== platform) return false
|
|
2323
|
+
return tuple.architectures.includes(arch)
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
function compareTuples (a, b) {
|
|
2328
|
+
// Prefer single-arch prebuilds over multi-arch
|
|
2329
|
+
return a.architectures.length - b.architectures.length
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
function parseTags (file) {
|
|
2333
|
+
var arr = file.split('.');
|
|
2334
|
+
var extension = arr.pop();
|
|
2335
|
+
var tags = { file: file, specificity: 0 };
|
|
2336
|
+
|
|
2337
|
+
if (extension !== 'node') return
|
|
2338
|
+
|
|
2339
|
+
for (var i = 0; i < arr.length; i++) {
|
|
2340
|
+
var tag = arr[i];
|
|
2341
|
+
|
|
2342
|
+
if (tag === 'node' || tag === 'electron' || tag === 'node-webkit') {
|
|
2343
|
+
tags.runtime = tag;
|
|
2344
|
+
} else if (tag === 'napi') {
|
|
2345
|
+
tags.napi = true;
|
|
2346
|
+
} else if (tag.slice(0, 3) === 'abi') {
|
|
2347
|
+
tags.abi = tag.slice(3);
|
|
2348
|
+
} else if (tag.slice(0, 2) === 'uv') {
|
|
2349
|
+
tags.uv = tag.slice(2);
|
|
2350
|
+
} else if (tag.slice(0, 4) === 'armv') {
|
|
2351
|
+
tags.armv = tag.slice(4);
|
|
2352
|
+
} else if (tag === 'glibc' || tag === 'musl') {
|
|
2353
|
+
tags.libc = tag;
|
|
2354
|
+
} else {
|
|
2355
|
+
continue
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
tags.specificity++;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
return tags
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
function matchTags (runtime, abi) {
|
|
2365
|
+
return function (tags) {
|
|
2366
|
+
if (tags == null) return false
|
|
2367
|
+
if (tags.runtime && tags.runtime !== runtime && !runtimeAgnostic(tags)) return false
|
|
2368
|
+
if (tags.abi && tags.abi !== abi && !tags.napi) return false
|
|
2369
|
+
if (tags.uv && tags.uv !== uv) return false
|
|
2370
|
+
if (tags.armv && tags.armv !== armv) return false
|
|
2371
|
+
if (tags.libc && tags.libc !== libc) return false
|
|
2372
|
+
|
|
2373
|
+
return true
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
function runtimeAgnostic (tags) {
|
|
2378
|
+
return tags.runtime === 'node' && tags.napi
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
function compareTags (runtime) {
|
|
2382
|
+
// Precedence: non-agnostic runtime, abi over napi, then by specificity.
|
|
2383
|
+
return function (a, b) {
|
|
2384
|
+
if (a.runtime !== b.runtime) {
|
|
2385
|
+
return a.runtime === runtime ? -1 : 1
|
|
2386
|
+
} else if (a.abi !== b.abi) {
|
|
2387
|
+
return a.abi ? -1 : 1
|
|
2388
|
+
} else if (a.specificity !== b.specificity) {
|
|
2389
|
+
return a.specificity > b.specificity ? -1 : 1
|
|
2390
|
+
} else {
|
|
2391
|
+
return 0
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
function isNwjs () {
|
|
2397
|
+
return !!(process.versions && process.versions.nw)
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
function isElectron () {
|
|
2401
|
+
if (process.versions && process.versions.electron) return true
|
|
2402
|
+
if (process.env.ELECTRON_RUN_AS_NODE) return true
|
|
2403
|
+
return typeof window !== 'undefined' && window.process && window.process.type === 'renderer'
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
function isAlpine (platform) {
|
|
2407
|
+
return platform === 'linux' && fs$1.existsSync('/etc/alpine-release')
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
// Exposed for unit tests
|
|
2411
|
+
// TODO: move to lib
|
|
2412
|
+
load.parseTags = parseTags;
|
|
2413
|
+
load.matchTags = matchTags;
|
|
2414
|
+
load.compareTags = compareTags;
|
|
2415
|
+
load.parseTuple = parseTuple;
|
|
2416
|
+
load.matchTuple = matchTuple;
|
|
2417
|
+
load.compareTuples = compareTuples;
|
|
2418
|
+
return nodeGypBuild;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
var hasRequiredNodeGypBuild;
|
|
2422
|
+
|
|
2423
|
+
function requireNodeGypBuild () {
|
|
2424
|
+
if (hasRequiredNodeGypBuild) return nodeGypBuild$1.exports;
|
|
2425
|
+
hasRequiredNodeGypBuild = 1;
|
|
2426
|
+
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : commonjsRequire; // eslint-disable-line
|
|
2427
|
+
if (typeof runtimeRequire.addon === 'function') { // if the platform supports native resolving prefer that
|
|
2428
|
+
nodeGypBuild$1.exports = runtimeRequire.addon.bind(runtimeRequire);
|
|
2429
|
+
} else { // else use the runtime version here
|
|
2430
|
+
nodeGypBuild$1.exports = requireNodeGypBuild$1();
|
|
2431
|
+
}
|
|
2432
|
+
return nodeGypBuild$1.exports;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
var fallback$1;
|
|
2436
|
+
var hasRequiredFallback$1;
|
|
2437
|
+
|
|
2438
|
+
function requireFallback$1 () {
|
|
2439
|
+
if (hasRequiredFallback$1) return fallback$1;
|
|
2440
|
+
hasRequiredFallback$1 = 1;
|
|
2441
|
+
|
|
2442
|
+
/**
|
|
2443
|
+
* Masks a buffer using the given mask.
|
|
2444
|
+
*
|
|
2445
|
+
* @param {Buffer} source The buffer to mask
|
|
2446
|
+
* @param {Buffer} mask The mask to use
|
|
2447
|
+
* @param {Buffer} output The buffer where to store the result
|
|
2448
|
+
* @param {Number} offset The offset at which to start writing
|
|
2449
|
+
* @param {Number} length The number of bytes to mask.
|
|
2450
|
+
* @public
|
|
2451
|
+
*/
|
|
2452
|
+
const mask = (source, mask, output, offset, length) => {
|
|
2453
|
+
for (var i = 0; i < length; i++) {
|
|
2454
|
+
output[offset + i] = source[i] ^ mask[i & 3];
|
|
2455
|
+
}
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2458
|
+
/**
|
|
2459
|
+
* Unmasks a buffer using the given mask.
|
|
2460
|
+
*
|
|
2461
|
+
* @param {Buffer} buffer The buffer to unmask
|
|
2462
|
+
* @param {Buffer} mask The mask to use
|
|
2463
|
+
* @public
|
|
2464
|
+
*/
|
|
2465
|
+
const unmask = (buffer, mask) => {
|
|
2466
|
+
// Required until https://github.com/nodejs/node/issues/9006 is resolved.
|
|
2467
|
+
const length = buffer.length;
|
|
2468
|
+
for (var i = 0; i < length; i++) {
|
|
2469
|
+
buffer[i] ^= mask[i & 3];
|
|
2470
|
+
}
|
|
2471
|
+
};
|
|
2472
|
+
|
|
2473
|
+
fallback$1 = { mask, unmask };
|
|
2474
|
+
return fallback$1;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
var hasRequiredBufferutil;
|
|
2478
|
+
|
|
2479
|
+
function requireBufferutil () {
|
|
2480
|
+
if (hasRequiredBufferutil) return bufferutil.exports;
|
|
2481
|
+
hasRequiredBufferutil = 1;
|
|
2482
|
+
|
|
2483
|
+
try {
|
|
2484
|
+
bufferutil.exports = requireNodeGypBuild()(__dirname);
|
|
2485
|
+
} catch (e) {
|
|
2486
|
+
bufferutil.exports = requireFallback$1();
|
|
2487
|
+
}
|
|
2488
|
+
return bufferutil.exports;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2195
2491
|
var hasRequiredBufferUtil;
|
|
2196
2492
|
|
|
2197
2493
|
function requireBufferUtil () {
|
|
@@ -2312,7 +2608,7 @@ function requireBufferUtil () {
|
|
|
2312
2608
|
/* istanbul ignore else */
|
|
2313
2609
|
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
2314
2610
|
try {
|
|
2315
|
-
const bufferUtil$1 =
|
|
2611
|
+
const bufferUtil$1 = requireBufferutil();
|
|
2316
2612
|
|
|
2317
2613
|
bufferUtil.exports.mask = function (source, mask, output, offset, length) {
|
|
2318
2614
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
@@ -2437,6 +2733,9 @@ function requirePermessageDeflate () {
|
|
|
2437
2733
|
* acknowledge disabling of client context takeover
|
|
2438
2734
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
2439
2735
|
* calls to zlib
|
|
2736
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
2737
|
+
* server or client mode
|
|
2738
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
2440
2739
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
2441
2740
|
* use of a custom server window size
|
|
2442
2741
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -2447,16 +2746,13 @@ function requirePermessageDeflate () {
|
|
|
2447
2746
|
* deflate
|
|
2448
2747
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
2449
2748
|
* inflate
|
|
2450
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
2451
|
-
* client mode
|
|
2452
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
2453
2749
|
*/
|
|
2454
|
-
constructor(options
|
|
2455
|
-
this._maxPayload = maxPayload | 0;
|
|
2750
|
+
constructor(options) {
|
|
2456
2751
|
this._options = options || {};
|
|
2457
2752
|
this._threshold =
|
|
2458
2753
|
this._options.threshold !== undefined ? this._options.threshold : 1024;
|
|
2459
|
-
this.
|
|
2754
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
2755
|
+
this._isServer = !!this._options.isServer;
|
|
2460
2756
|
this._deflate = null;
|
|
2461
2757
|
this._inflate = null;
|
|
2462
2758
|
|
|
@@ -2567,7 +2863,9 @@ function requirePermessageDeflate () {
|
|
|
2567
2863
|
(typeof opts.serverMaxWindowBits === 'number' &&
|
|
2568
2864
|
opts.serverMaxWindowBits > params.server_max_window_bits))) ||
|
|
2569
2865
|
(typeof opts.clientMaxWindowBits === 'number' &&
|
|
2570
|
-
|
|
2866
|
+
(typeof params.client_max_window_bits === 'number'
|
|
2867
|
+
? opts.clientMaxWindowBits > params.client_max_window_bits
|
|
2868
|
+
: !params.client_max_window_bits))
|
|
2571
2869
|
) {
|
|
2572
2870
|
return false;
|
|
2573
2871
|
}
|
|
@@ -2931,6 +3229,92 @@ function requirePermessageDeflate () {
|
|
|
2931
3229
|
|
|
2932
3230
|
var validation = {exports: {}};
|
|
2933
3231
|
|
|
3232
|
+
var utf8Validate = {exports: {}};
|
|
3233
|
+
|
|
3234
|
+
var fallback;
|
|
3235
|
+
var hasRequiredFallback;
|
|
3236
|
+
|
|
3237
|
+
function requireFallback () {
|
|
3238
|
+
if (hasRequiredFallback) return fallback;
|
|
3239
|
+
hasRequiredFallback = 1;
|
|
3240
|
+
|
|
3241
|
+
/**
|
|
3242
|
+
* Checks if a given buffer contains only correct UTF-8.
|
|
3243
|
+
* Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
|
|
3244
|
+
* Markus Kuhn.
|
|
3245
|
+
*
|
|
3246
|
+
* @param {Buffer} buf The buffer to check
|
|
3247
|
+
* @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
|
|
3248
|
+
* @public
|
|
3249
|
+
*/
|
|
3250
|
+
function isValidUTF8(buf) {
|
|
3251
|
+
const len = buf.length;
|
|
3252
|
+
let i = 0;
|
|
3253
|
+
|
|
3254
|
+
while (i < len) {
|
|
3255
|
+
if ((buf[i] & 0x80) === 0x00) { // 0xxxxxxx
|
|
3256
|
+
i++;
|
|
3257
|
+
} else if ((buf[i] & 0xe0) === 0xc0) { // 110xxxxx 10xxxxxx
|
|
3258
|
+
if (
|
|
3259
|
+
i + 1 === len ||
|
|
3260
|
+
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3261
|
+
(buf[i] & 0xfe) === 0xc0 // overlong
|
|
3262
|
+
) {
|
|
3263
|
+
return false;
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
i += 2;
|
|
3267
|
+
} else if ((buf[i] & 0xf0) === 0xe0) { // 1110xxxx 10xxxxxx 10xxxxxx
|
|
3268
|
+
if (
|
|
3269
|
+
i + 2 >= len ||
|
|
3270
|
+
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3271
|
+
(buf[i + 2] & 0xc0) !== 0x80 ||
|
|
3272
|
+
buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80 || // overlong
|
|
3273
|
+
buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)
|
|
3274
|
+
) {
|
|
3275
|
+
return false;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
i += 3;
|
|
3279
|
+
} else if ((buf[i] & 0xf8) === 0xf0) { // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
|
3280
|
+
if (
|
|
3281
|
+
i + 3 >= len ||
|
|
3282
|
+
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3283
|
+
(buf[i + 2] & 0xc0) !== 0x80 ||
|
|
3284
|
+
(buf[i + 3] & 0xc0) !== 0x80 ||
|
|
3285
|
+
buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80 || // overlong
|
|
3286
|
+
buf[i] === 0xf4 && buf[i + 1] > 0x8f || buf[i] > 0xf4 // > U+10FFFF
|
|
3287
|
+
) {
|
|
3288
|
+
return false;
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
i += 4;
|
|
3292
|
+
} else {
|
|
3293
|
+
return false;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
return true;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
fallback = isValidUTF8;
|
|
3301
|
+
return fallback;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
var hasRequiredUtf8Validate;
|
|
3305
|
+
|
|
3306
|
+
function requireUtf8Validate () {
|
|
3307
|
+
if (hasRequiredUtf8Validate) return utf8Validate.exports;
|
|
3308
|
+
hasRequiredUtf8Validate = 1;
|
|
3309
|
+
|
|
3310
|
+
try {
|
|
3311
|
+
utf8Validate.exports = requireNodeGypBuild()(__dirname);
|
|
3312
|
+
} catch (e) {
|
|
3313
|
+
utf8Validate.exports = requireFallback();
|
|
3314
|
+
}
|
|
3315
|
+
return utf8Validate.exports;
|
|
3316
|
+
}
|
|
3317
|
+
|
|
2934
3318
|
var hasRequiredValidation;
|
|
2935
3319
|
|
|
2936
3320
|
function requireValidation () {
|
|
@@ -3078,7 +3462,7 @@ function requireValidation () {
|
|
|
3078
3462
|
};
|
|
3079
3463
|
} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
3080
3464
|
try {
|
|
3081
|
-
const isValidUTF8 =
|
|
3465
|
+
const isValidUTF8 = requireUtf8Validate();
|
|
3082
3466
|
|
|
3083
3467
|
validation.exports.isValidUTF8 = function (buf) {
|
|
3084
3468
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
@@ -3137,6 +3521,10 @@ function requireReceiver () {
|
|
|
3137
3521
|
* extensions
|
|
3138
3522
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
3139
3523
|
* client or server mode
|
|
3524
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
3525
|
+
* buffered data chunks
|
|
3526
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
3527
|
+
* fragments
|
|
3140
3528
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
3141
3529
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
3142
3530
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -3151,6 +3539,8 @@ function requireReceiver () {
|
|
|
3151
3539
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
3152
3540
|
this._extensions = options.extensions || {};
|
|
3153
3541
|
this._isServer = !!options.isServer;
|
|
3542
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
3543
|
+
this._maxFragments = options.maxFragments | 0;
|
|
3154
3544
|
this._maxPayload = options.maxPayload | 0;
|
|
3155
3545
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
3156
3546
|
this[kWebSocket] = undefined;
|
|
@@ -3168,6 +3558,7 @@ function requireReceiver () {
|
|
|
3168
3558
|
|
|
3169
3559
|
this._totalPayloadLength = 0;
|
|
3170
3560
|
this._messageLength = 0;
|
|
3561
|
+
this._numFragments = 0;
|
|
3171
3562
|
this._fragments = [];
|
|
3172
3563
|
|
|
3173
3564
|
this._errored = false;
|
|
@@ -3186,6 +3577,22 @@ function requireReceiver () {
|
|
|
3186
3577
|
_write(chunk, encoding, cb) {
|
|
3187
3578
|
if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
|
|
3188
3579
|
|
|
3580
|
+
if (
|
|
3581
|
+
this._maxBufferedChunks > 0 &&
|
|
3582
|
+
this._buffers.length >= this._maxBufferedChunks
|
|
3583
|
+
) {
|
|
3584
|
+
cb(
|
|
3585
|
+
this.createError(
|
|
3586
|
+
RangeError,
|
|
3587
|
+
'Too many buffered chunks',
|
|
3588
|
+
false,
|
|
3589
|
+
1008,
|
|
3590
|
+
'WS_ERR_TOO_MANY_BUFFERED_PARTS'
|
|
3591
|
+
)
|
|
3592
|
+
);
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3189
3596
|
this._bufferedBytes += chunk.length;
|
|
3190
3597
|
this._buffers.push(chunk);
|
|
3191
3598
|
this.startLoop(cb);
|
|
@@ -3575,6 +3982,19 @@ function requireReceiver () {
|
|
|
3575
3982
|
return;
|
|
3576
3983
|
}
|
|
3577
3984
|
|
|
3985
|
+
if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
|
|
3986
|
+
const error = this.createError(
|
|
3987
|
+
RangeError,
|
|
3988
|
+
'Too many message fragments',
|
|
3989
|
+
false,
|
|
3990
|
+
1008,
|
|
3991
|
+
'WS_ERR_TOO_MANY_BUFFERED_PARTS'
|
|
3992
|
+
);
|
|
3993
|
+
|
|
3994
|
+
cb(error);
|
|
3995
|
+
return;
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3578
3998
|
if (this._compressed) {
|
|
3579
3999
|
this._state = INFLATING;
|
|
3580
4000
|
this.decompress(data, cb);
|
|
@@ -3647,6 +4067,7 @@ function requireReceiver () {
|
|
|
3647
4067
|
this._totalPayloadLength = 0;
|
|
3648
4068
|
this._messageLength = 0;
|
|
3649
4069
|
this._fragmented = 0;
|
|
4070
|
+
this._numFragments = 0;
|
|
3650
4071
|
this._fragments = [];
|
|
3651
4072
|
|
|
3652
4073
|
if (this._opcode === 2) {
|
|
@@ -3815,6 +4236,9 @@ function requireSender () {
|
|
|
3815
4236
|
|
|
3816
4237
|
const { Duplex } = require$$0$2;
|
|
3817
4238
|
const { randomFillSync } = require$$1;
|
|
4239
|
+
const {
|
|
4240
|
+
types: { isUint8Array }
|
|
4241
|
+
} = require$$2$1;
|
|
3818
4242
|
|
|
3819
4243
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
3820
4244
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
|
|
@@ -4011,8 +4435,10 @@ function requireSender () {
|
|
|
4011
4435
|
|
|
4012
4436
|
if (typeof data === 'string') {
|
|
4013
4437
|
buf.write(data, 2);
|
|
4014
|
-
} else {
|
|
4438
|
+
} else if (isUint8Array(data)) {
|
|
4015
4439
|
buf.set(data, 2);
|
|
4440
|
+
} else {
|
|
4441
|
+
throw new TypeError('Second argument must be a string or a Uint8Array');
|
|
4016
4442
|
}
|
|
4017
4443
|
}
|
|
4018
4444
|
|
|
@@ -4936,7 +5362,7 @@ function requireWebsocket () {
|
|
|
4936
5362
|
|
|
4937
5363
|
const EventEmitter = require$$0$3;
|
|
4938
5364
|
const https = require$$1$1;
|
|
4939
|
-
const http = require$$2;
|
|
5365
|
+
const http = require$$2$2;
|
|
4940
5366
|
const net$1 = net;
|
|
4941
5367
|
const tls = require$$4;
|
|
4942
5368
|
const { randomBytes, createHash } = require$$1;
|
|
@@ -4950,6 +5376,7 @@ function requireWebsocket () {
|
|
|
4950
5376
|
|
|
4951
5377
|
const {
|
|
4952
5378
|
BINARY_TYPES,
|
|
5379
|
+
CLOSE_TIMEOUT,
|
|
4953
5380
|
EMPTY_BUFFER,
|
|
4954
5381
|
GUID,
|
|
4955
5382
|
kForOnEventAttribute,
|
|
@@ -4964,7 +5391,6 @@ function requireWebsocket () {
|
|
|
4964
5391
|
const { format, parse } = requireExtension();
|
|
4965
5392
|
const { toBuffer } = requireBufferUtil();
|
|
4966
5393
|
|
|
4967
|
-
const closeTimeout = 30 * 1000;
|
|
4968
5394
|
const kAborted = Symbol('kAborted');
|
|
4969
5395
|
const protocolVersions = [8, 13];
|
|
4970
5396
|
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
@@ -5020,6 +5446,7 @@ function requireWebsocket () {
|
|
|
5020
5446
|
initAsClient(this, address, protocols, options);
|
|
5021
5447
|
} else {
|
|
5022
5448
|
this._autoPong = options.autoPong;
|
|
5449
|
+
this._closeTimeout = options.closeTimeout;
|
|
5023
5450
|
this._isServer = true;
|
|
5024
5451
|
}
|
|
5025
5452
|
}
|
|
@@ -5132,6 +5559,10 @@ function requireWebsocket () {
|
|
|
5132
5559
|
* multiple times in the same tick
|
|
5133
5560
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
5134
5561
|
* masking key
|
|
5562
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
5563
|
+
* buffered data chunks
|
|
5564
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
5565
|
+
* fragments
|
|
5135
5566
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
5136
5567
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
5137
5568
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -5143,6 +5574,8 @@ function requireWebsocket () {
|
|
|
5143
5574
|
binaryType: this.binaryType,
|
|
5144
5575
|
extensions: this._extensions,
|
|
5145
5576
|
isServer: this._isServer,
|
|
5577
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
5578
|
+
maxFragments: options.maxFragments,
|
|
5146
5579
|
maxPayload: options.maxPayload,
|
|
5147
5580
|
skipUTF8Validation: options.skipUTF8Validation
|
|
5148
5581
|
});
|
|
@@ -5561,6 +5994,8 @@ function requireWebsocket () {
|
|
|
5561
5994
|
* times in the same tick
|
|
5562
5995
|
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
5563
5996
|
* automatically send a pong in response to a ping
|
|
5997
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
|
|
5998
|
+
* for the closing handshake to finish after `websocket.close()` is called
|
|
5564
5999
|
* @param {Function} [options.finishRequest] A function which can be used to
|
|
5565
6000
|
* customize the headers of each http request before it is sent
|
|
5566
6001
|
* @param {Boolean} [options.followRedirects=false] Whether or not to follow
|
|
@@ -5569,6 +6004,10 @@ function requireWebsocket () {
|
|
|
5569
6004
|
* masking key
|
|
5570
6005
|
* @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
|
|
5571
6006
|
* handshake request
|
|
6007
|
+
* @param {Number} [options.maxBufferedChunks=262144] The maximum number of
|
|
6008
|
+
* buffered data chunks
|
|
6009
|
+
* @param {Number} [options.maxFragments=16384] The maximum number of message
|
|
6010
|
+
* fragments
|
|
5572
6011
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
5573
6012
|
* size
|
|
5574
6013
|
* @param {Number} [options.maxRedirects=10] The maximum number of redirects
|
|
@@ -5587,7 +6026,10 @@ function requireWebsocket () {
|
|
|
5587
6026
|
const opts = {
|
|
5588
6027
|
allowSynchronousEvents: true,
|
|
5589
6028
|
autoPong: true,
|
|
6029
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
5590
6030
|
protocolVersion: protocolVersions[1],
|
|
6031
|
+
maxBufferedChunks: 256 * 1024,
|
|
6032
|
+
maxFragments: 16 * 1024,
|
|
5591
6033
|
maxPayload: 100 * 1024 * 1024,
|
|
5592
6034
|
skipUTF8Validation: false,
|
|
5593
6035
|
perMessageDeflate: true,
|
|
@@ -5605,6 +6047,7 @@ function requireWebsocket () {
|
|
|
5605
6047
|
};
|
|
5606
6048
|
|
|
5607
6049
|
websocket._autoPong = opts.autoPong;
|
|
6050
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
5608
6051
|
|
|
5609
6052
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
5610
6053
|
throw new RangeError(
|
|
@@ -5620,7 +6063,7 @@ function requireWebsocket () {
|
|
|
5620
6063
|
} else {
|
|
5621
6064
|
try {
|
|
5622
6065
|
parsedUrl = new URL(address);
|
|
5623
|
-
} catch
|
|
6066
|
+
} catch {
|
|
5624
6067
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
5625
6068
|
}
|
|
5626
6069
|
}
|
|
@@ -5682,11 +6125,11 @@ function requireWebsocket () {
|
|
|
5682
6125
|
opts.timeout = opts.handshakeTimeout;
|
|
5683
6126
|
|
|
5684
6127
|
if (opts.perMessageDeflate) {
|
|
5685
|
-
perMessageDeflate = new PerMessageDeflate(
|
|
5686
|
-
opts.perMessageDeflate
|
|
5687
|
-
false,
|
|
5688
|
-
opts.maxPayload
|
|
5689
|
-
);
|
|
6128
|
+
perMessageDeflate = new PerMessageDeflate({
|
|
6129
|
+
...opts.perMessageDeflate,
|
|
6130
|
+
isServer: false,
|
|
6131
|
+
maxPayload: opts.maxPayload
|
|
6132
|
+
});
|
|
5690
6133
|
opts.headers['Sec-WebSocket-Extensions'] = format({
|
|
5691
6134
|
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
5692
6135
|
});
|
|
@@ -5944,6 +6387,8 @@ function requireWebsocket () {
|
|
|
5944
6387
|
websocket.setSocket(socket, head, {
|
|
5945
6388
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
5946
6389
|
generateMask: opts.generateMask,
|
|
6390
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
6391
|
+
maxFragments: opts.maxFragments,
|
|
5947
6392
|
maxPayload: opts.maxPayload,
|
|
5948
6393
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
5949
6394
|
});
|
|
@@ -6222,7 +6667,7 @@ function requireWebsocket () {
|
|
|
6222
6667
|
function setCloseTimer(websocket) {
|
|
6223
6668
|
websocket._closeTimer = setTimeout(
|
|
6224
6669
|
websocket._socket.destroy.bind(websocket._socket),
|
|
6225
|
-
|
|
6670
|
+
websocket._closeTimeout
|
|
6226
6671
|
);
|
|
6227
6672
|
}
|
|
6228
6673
|
|
|
@@ -6240,23 +6685,23 @@ function requireWebsocket () {
|
|
|
6240
6685
|
|
|
6241
6686
|
websocket._readyState = WebSocket.CLOSING;
|
|
6242
6687
|
|
|
6243
|
-
let chunk;
|
|
6244
|
-
|
|
6245
6688
|
//
|
|
6246
6689
|
// The close frame might not have been received or the `'end'` event emitted,
|
|
6247
6690
|
// for example, if the socket was destroyed due to an error. Ensure that the
|
|
6248
6691
|
// `receiver` stream is closed after writing any remaining buffered data to
|
|
6249
6692
|
// it. If the readable side of the socket is in flowing mode then there is no
|
|
6250
|
-
// buffered data as everything has been already written
|
|
6251
|
-
//
|
|
6252
|
-
//
|
|
6693
|
+
// buffered data as everything has been already written. If instead, the
|
|
6694
|
+
// socket is paused, any possible buffered data will be read as a single
|
|
6695
|
+
// chunk.
|
|
6253
6696
|
//
|
|
6254
6697
|
if (
|
|
6255
6698
|
!this._readableState.endEmitted &&
|
|
6256
6699
|
!websocket._closeFrameReceived &&
|
|
6257
6700
|
!websocket._receiver._writableState.errorEmitted &&
|
|
6258
|
-
|
|
6701
|
+
this._readableState.length !== 0
|
|
6259
6702
|
) {
|
|
6703
|
+
const chunk = this.read(this._readableState.length);
|
|
6704
|
+
|
|
6260
6705
|
websocket._receiver.write(chunk);
|
|
6261
6706
|
}
|
|
6262
6707
|
|
|
@@ -6493,13 +6938,14 @@ function requireStream () {
|
|
|
6493
6938
|
|
|
6494
6939
|
requireStream();
|
|
6495
6940
|
|
|
6941
|
+
requireExtension();
|
|
6942
|
+
|
|
6943
|
+
requirePermessageDeflate();
|
|
6944
|
+
|
|
6496
6945
|
requireReceiver();
|
|
6497
6946
|
|
|
6498
6947
|
requireSender();
|
|
6499
6948
|
|
|
6500
|
-
var websocketExports = requireWebsocket();
|
|
6501
|
-
var WebSocket = /*@__PURE__*/getDefaultExportFromCjs(websocketExports);
|
|
6502
|
-
|
|
6503
6949
|
var subprotocol;
|
|
6504
6950
|
var hasRequiredSubprotocol;
|
|
6505
6951
|
|
|
@@ -6570,6 +7016,11 @@ function requireSubprotocol () {
|
|
|
6570
7016
|
return subprotocol;
|
|
6571
7017
|
}
|
|
6572
7018
|
|
|
7019
|
+
requireSubprotocol();
|
|
7020
|
+
|
|
7021
|
+
var websocketExports = requireWebsocket();
|
|
7022
|
+
var WebSocket = /*@__PURE__*/getDefaultExportFromCjs(websocketExports);
|
|
7023
|
+
|
|
6573
7024
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
|
|
6574
7025
|
|
|
6575
7026
|
var websocketServer;
|
|
@@ -6580,7 +7031,7 @@ function requireWebsocketServer () {
|
|
|
6580
7031
|
hasRequiredWebsocketServer = 1;
|
|
6581
7032
|
|
|
6582
7033
|
const EventEmitter = require$$0$3;
|
|
6583
|
-
const http = require$$2;
|
|
7034
|
+
const http = require$$2$2;
|
|
6584
7035
|
const { Duplex } = require$$0$2;
|
|
6585
7036
|
const { createHash } = require$$1;
|
|
6586
7037
|
|
|
@@ -6588,7 +7039,7 @@ function requireWebsocketServer () {
|
|
|
6588
7039
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
6589
7040
|
const subprotocol = requireSubprotocol();
|
|
6590
7041
|
const WebSocket = requireWebsocket();
|
|
6591
|
-
const { GUID, kWebSocket } = requireConstants();
|
|
7042
|
+
const { CLOSE_TIMEOUT, GUID, kWebSocket } = requireConstants();
|
|
6592
7043
|
|
|
6593
7044
|
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
6594
7045
|
|
|
@@ -6615,8 +7066,15 @@ function requireWebsocketServer () {
|
|
|
6615
7066
|
* pending connections
|
|
6616
7067
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
6617
7068
|
* track clients
|
|
7069
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
7070
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
7071
|
+
* called
|
|
6618
7072
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
6619
7073
|
* @param {String} [options.host] The hostname where to bind the server
|
|
7074
|
+
* @param {Number} [options.maxBufferedChunks=262144] The maximum number of
|
|
7075
|
+
* buffered data chunks
|
|
7076
|
+
* @param {Number} [options.maxFragments=16384] The maximum number of message
|
|
7077
|
+
* fragments
|
|
6620
7078
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
6621
7079
|
* size
|
|
6622
7080
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -6639,11 +7097,14 @@ function requireWebsocketServer () {
|
|
|
6639
7097
|
options = {
|
|
6640
7098
|
allowSynchronousEvents: true,
|
|
6641
7099
|
autoPong: true,
|
|
7100
|
+
maxBufferedChunks: 256 * 1024,
|
|
7101
|
+
maxFragments: 16 * 1024,
|
|
6642
7102
|
maxPayload: 100 * 1024 * 1024,
|
|
6643
7103
|
skipUTF8Validation: false,
|
|
6644
7104
|
perMessageDeflate: false,
|
|
6645
7105
|
handleProtocols: null,
|
|
6646
7106
|
clientTracking: true,
|
|
7107
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
6647
7108
|
verifyClient: null,
|
|
6648
7109
|
noServer: false,
|
|
6649
7110
|
backlog: null, // use default (511 as implemented in net.js)
|
|
@@ -6866,11 +7327,11 @@ function requireWebsocketServer () {
|
|
|
6866
7327
|
this.options.perMessageDeflate &&
|
|
6867
7328
|
secWebSocketExtensions !== undefined
|
|
6868
7329
|
) {
|
|
6869
|
-
const perMessageDeflate = new PerMessageDeflate(
|
|
6870
|
-
this.options.perMessageDeflate,
|
|
6871
|
-
true,
|
|
6872
|
-
this.options.maxPayload
|
|
6873
|
-
);
|
|
7330
|
+
const perMessageDeflate = new PerMessageDeflate({
|
|
7331
|
+
...this.options.perMessageDeflate,
|
|
7332
|
+
isServer: true,
|
|
7333
|
+
maxPayload: this.options.maxPayload
|
|
7334
|
+
});
|
|
6874
7335
|
|
|
6875
7336
|
try {
|
|
6876
7337
|
const offers = extension.parse(secWebSocketExtensions);
|
|
@@ -6997,6 +7458,8 @@ function requireWebsocketServer () {
|
|
|
6997
7458
|
|
|
6998
7459
|
ws.setSocket(socket, head, {
|
|
6999
7460
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
7461
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
7462
|
+
maxFragments: this.options.maxFragments,
|
|
7000
7463
|
maxPayload: this.options.maxPayload,
|
|
7001
7464
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
7002
7465
|
});
|