+1
-0
@@ -10,2 +10,3 @@ 'use strict'; | ||
| BINARY_TYPES, | ||
| CLOSE_TIMEOUT: 30000, | ||
| EMPTY_BUFFER: Buffer.alloc(0), | ||
@@ -12,0 +13,0 @@ GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', |
@@ -14,3 +14,3 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */ | ||
| const WebSocket = require('./websocket'); | ||
| const { GUID, kWebSocket } = require('./constants'); | ||
| const { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants'); | ||
@@ -42,2 +42,5 @@ const keyRegex = /^[+/0-9A-Za-z]{22}==$/; | ||
| * track clients | ||
| * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to | ||
| * wait for the closing handshake to finish after `websocket.close()` is | ||
| * called | ||
| * @param {Function} [options.handleProtocols] A hook to handle protocols | ||
@@ -72,2 +75,3 @@ * @param {String} [options.host] The hostname where to bind the server | ||
| clientTracking: true, | ||
| closeTimeout: CLOSE_TIMEOUT, | ||
| verifyClient: null, | ||
@@ -74,0 +78,0 @@ noServer: false, |
+13
-8
@@ -21,2 +21,3 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */ | ||
| BINARY_TYPES, | ||
| CLOSE_TIMEOUT, | ||
| EMPTY_BUFFER, | ||
@@ -36,3 +37,2 @@ GUID, | ||
| const closeTimeout = 30 * 1000; | ||
| const kAborted = Symbol('kAborted'); | ||
@@ -93,2 +93,3 @@ const protocolVersions = [8, 13]; | ||
| this._autoPong = options.autoPong; | ||
| this._closeTimeout = options.closeTimeout; | ||
| this._isServer = true; | ||
@@ -635,2 +636,4 @@ } | ||
| * automatically send a pong in response to a ping | ||
| * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait | ||
| * for the closing handshake to finish after `websocket.close()` is called | ||
| * @param {Function} [options.finishRequest] A function which can be used to | ||
@@ -662,2 +665,3 @@ * customize the headers of each http request before it is sent | ||
| autoPong: true, | ||
| closeTimeout: CLOSE_TIMEOUT, | ||
| protocolVersion: protocolVersions[1], | ||
@@ -681,2 +685,3 @@ maxPayload: 100 * 1024 * 1024, | ||
| websocket._autoPong = opts.autoPong; | ||
| websocket._closeTimeout = opts.closeTimeout; | ||
@@ -1299,3 +1304,3 @@ if (!protocolVersions.includes(opts.protocolVersion)) { | ||
| websocket._socket.destroy.bind(websocket._socket), | ||
| closeTimeout | ||
| websocket._closeTimeout | ||
| ); | ||
@@ -1318,4 +1323,2 @@ } | ||
| let chunk; | ||
| // | ||
@@ -1326,5 +1329,5 @@ // The close frame might not have been received or the `'end'` event emitted, | ||
| // it. If the readable side of the socket is in flowing mode then there is no | ||
| // buffered data as everything has been already written and `readable.read()` | ||
| // will return `null`. If instead, the socket is paused, any possible buffered | ||
| // data will be read as a single chunk. | ||
| // buffered data as everything has been already written. If instead, the | ||
| // socket is paused, any possible buffered data will be read as a single | ||
| // chunk. | ||
| // | ||
@@ -1335,4 +1338,6 @@ if ( | ||
| !websocket._receiver._writableState.errorEmitted && | ||
| (chunk = websocket._socket.read()) !== null | ||
| this._readableState.length !== 0 | ||
| ) { | ||
| const chunk = this.read(this._readableState.length); | ||
| websocket._receiver.write(chunk); | ||
@@ -1339,0 +1344,0 @@ } |
+1
-1
| { | ||
| "name": "ws", | ||
| "version": "8.18.3", | ||
| "version": "8.19.0", | ||
| "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
147844
0.36%4249
0.24%