Socket
Socket
Sign inDemoInstall

ws

Package Overview
Dependencies
1
Maintainers
4
Versions
164
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.0 to 6.2.1

18

lib/sender.js

@@ -46,3 +46,3 @@ 'use strict';

static frame(data, options) {
const merge = data.length < 1024 || (options.mask && options.readOnly);
const merge = options.mask && options.readOnly;
var offset = options.mask ? 6 : 2;

@@ -64,2 +64,4 @@ var payloadLength = data.length;

target[1] = payloadLength;
if (payloadLength === 126) {

@@ -72,15 +74,7 @@ target.writeUInt16BE(data.length, 2);

if (!options.mask) {
target[1] = payloadLength;
if (merge) {
data.copy(target, offset);
return [target];
}
if (!options.mask) return [target, data];
return [target, data];
}
const mask = randomBytes(4);
target[1] = payloadLength | 0x80;
target[1] |= 0x80;
target[offset - 4] = mask[0];

@@ -357,4 +351,6 @@ target[offset - 3] = mask[1];

if (list.length === 2) {
this._socket.cork();
this._socket.write(list[0]);
this._socket.write(list[1], cb);
this._socket.uncork();
} else {

@@ -361,0 +357,0 @@ this._socket.write(list[0], cb);

@@ -24,12 +24,16 @@ 'use strict';

* @param {Object} options Configuration options
* @param {Number} options.backlog The maximum length of the queue of pending
* connections
* @param {Boolean} options.clientTracking Specifies whether or not to track
* clients
* @param {Function} options.handleProtocols An hook to handle protocols
* @param {String} options.host The hostname where to bind the server
* @param {Number} options.maxPayload The maximum allowed message size
* @param {Boolean} options.noServer Enable no server mode
* @param {String} options.path Accept only connections matching this path
* @param {(Boolean|Object)} options.perMessageDeflate Enable/disable
* permessage-deflate
* @param {Number} options.port The port where to bind the server
* @param {http.Server} options.server A pre-created HTTP/S server to use
* @param {Function} options.verifyClient An hook to reject connections
* @param {Function} options.handleProtocols An hook to handle protocols
* @param {String} options.path Accept only connections matching this path
* @param {Boolean} options.noServer Enable no server mode
* @param {Boolean} options.clientTracking Specifies whether or not to track clients
* @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate
* @param {Number} options.maxPayload The maximum allowed message size
* @param {Function} callback A listener for the `listening` event

@@ -36,0 +40,0 @@ */

@@ -27,3 +27,3 @@ 'use strict';

const protocolVersions = [8, 13];
const closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly.
const closeTimeout = 30 * 1000;

@@ -91,4 +91,5 @@ /**

/**
* This deviates from the WHATWG interface since ws doesn't support the required
* default "blob" type (instead we define a custom "nodebuffer" type).
* This deviates from the WHATWG interface since ws doesn't support the
* required default "blob" type (instead we define a custom "nodebuffer"
* type).
*

@@ -235,16 +236,12 @@ * @type {String}

this._closeFrameSent = true;
if (this._closeFrameReceived) this._socket.end();
});
if (this._socket.writable) {
if (this._closeFrameReceived) this._socket.end();
//
// Ensure that the connection is closed even if the closing handshake
// fails.
//
this._closeTimer = setTimeout(
this._socket.destroy.bind(this._socket),
closeTimeout
);
}
});
//
// Specify a timeout for the closing handshake to complete.
//
this._closeTimer = setTimeout(
this._socket.destroy.bind(this._socket),
closeTimeout
);
}

@@ -899,6 +896,4 @@

if (websocket) {
websocket.readyState = WebSocket.CLOSING;
this.destroy();
}
websocket.readyState = WebSocket.CLOSING;
this.destroy();
}
{
"name": "ws",
"version": "6.2.0",
"version": "6.2.1",
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc