Comparing version 8.14.2 to 8.15.0
@@ -42,2 +42,5 @@ 'use strict'; | ||
* @param {Object} [options] Options object | ||
* @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies | ||
* whether or not to process more than one of the `'message'`, `'ping'`, | ||
* and `'pong'` events per microtask | ||
* @param {String} [options.binaryType=nodebuffer] The type for binary data | ||
@@ -55,2 +58,4 @@ * @param {Object} [options.extensions] An object containing the negotiated | ||
this._allowMultipleEventsPerMicrotask = | ||
!!options.allowMultipleEventsPerMicrotask; | ||
this._binaryType = options.binaryType || BINARY_TYPES[0]; | ||
@@ -566,3 +571,5 @@ this._extensions = options.extensions || {}; | ||
this._state = WAIT_MICROTASK; | ||
this._state = this._allowMultipleEventsPerMicrotask | ||
? GET_INFO | ||
: WAIT_MICROTASK; | ||
} | ||
@@ -584,4 +591,2 @@ | ||
this.end(); | ||
this._state = GET_INFO; | ||
} else { | ||
@@ -618,12 +623,12 @@ const code = data.readUInt16BE(0); | ||
this.end(); | ||
} | ||
this._state = GET_INFO; | ||
} | ||
} else if (this._opcode === 0x09) { | ||
this.emit('ping', data); | ||
this._state = WAIT_MICROTASK; | ||
} else { | ||
this.emit('pong', data); | ||
this._state = WAIT_MICROTASK; | ||
this._state = GET_INFO; | ||
return; | ||
} | ||
this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); | ||
this._state = this._allowMultipleEventsPerMicrotask | ||
? GET_INFO | ||
: WAIT_MICROTASK; | ||
} | ||
@@ -630,0 +635,0 @@ } |
@@ -32,2 +32,5 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$" }] */ | ||
* @param {Object} options Configuration options | ||
* @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies | ||
* whether or not to process more than one of the `'message'`, `'ping'`, | ||
* and `'pong'` events per microtask | ||
* @param {Number} [options.backlog=511] The maximum length of the queue of | ||
@@ -59,2 +62,3 @@ * pending connections | ||
options = { | ||
allowMultipleEventsPerMicrotask: false, | ||
maxPayload: 100 * 1024 * 1024, | ||
@@ -414,2 +418,4 @@ skipUTF8Validation: false, | ||
ws.setSocket(socket, head, { | ||
allowMultipleEventsPerMicrotask: | ||
this.options.allowMultipleEventsPerMicrotask, | ||
maxPayload: this.options.maxPayload, | ||
@@ -416,0 +422,0 @@ skipUTF8Validation: this.options.skipUTF8Validation |
@@ -195,2 +195,5 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$" }] */ | ||
* @param {Object} options Options object | ||
* @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies | ||
* whether or not to process more than one of the `'message'`, `'ping'`, | ||
* and `'pong'` events per microtask | ||
* @param {Function} [options.generateMask] The function used to generate the | ||
@@ -205,2 +208,3 @@ * masking key | ||
const receiver = new Receiver({ | ||
allowMultipleEventsPerMicrotask: options.allowMultipleEventsPerMicrotask, | ||
binaryType: this.binaryType, | ||
@@ -623,2 +627,7 @@ extensions: this._extensions, | ||
* @param {Object} [options] Connection options | ||
* @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies | ||
* whether or not to process more than one of the `'message'`, `'ping'`, | ||
* and `'pong'` events per microtask | ||
* @param {Function} [options.finishRequest] A function which can be used to | ||
* customize the headers of each http request before it is sent | ||
* @param {Boolean} [options.followRedirects=false] Whether or not to follow | ||
@@ -646,2 +655,3 @@ * redirects | ||
const opts = { | ||
allowMultipleEventsPerMicrotask: false, | ||
protocolVersion: protocolVersions[1], | ||
@@ -813,4 +823,4 @@ maxPayload: 100 * 1024 * 1024, | ||
: websocket._originalIpc | ||
? false | ||
: parsedUrl.host === websocket._originalHostOrSocketPath; | ||
? false | ||
: parsedUrl.host === websocket._originalHostOrSocketPath; | ||
@@ -999,2 +1009,3 @@ if (!isSameHost || (websocket._originalSecure && !isSecure)) { | ||
websocket.setSocket(socket, head, { | ||
allowMultipleEventsPerMicrotask: opts.allowMultipleEventsPerMicrotask, | ||
generateMask: opts.generateMask, | ||
@@ -1001,0 +1012,0 @@ maxPayload: opts.maxPayload, |
{ | ||
"name": "ws", | ||
"version": "8.14.2", | ||
"version": "8.15.0", | ||
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
139675
4014