New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

websocket13

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websocket13 - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

0

examples/echoclient.js

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

64

lib/base.js

@@ -19,2 +19,3 @@ const ByteBuffer = require('bytebuffer');

this.protocol = null;
this.stats = {tx: {wire: 0, preExt: 0}, rx: {wire: 0, postExt: 0}};

@@ -315,2 +316,6 @@ this.options = {

let overheadLength = getFrameOverheadLength(frame);
this.stats.rx.wire += overheadLength + frame.payload.length;
this.stats.rx.postExt += overheadLength; // extensions can't change overhead length
let debugMsg = "Got frame " + frame.opcode.toString(16).toUpperCase() + ", " + (frame.FIN ? "FIN, " : "");

@@ -375,2 +380,3 @@ for (let i = 1; i <= 3; i++) {

frame = fromExtensionMessage(msg);
this.stats.rx.postExt += frame.payload.length;

@@ -479,2 +485,8 @@ switch (frame.opcode) {

// record this start frame in stats only if we've dispatched the stream. if we haven't, we'll process the whole
// message as one.
if (dispatch) {
this.stats.rx.postExt += frame.payload.length;
}
return;

@@ -487,2 +499,8 @@ }

// record this frame in stats only if we've dispatched the stream. if we haven't, we'll process the whole
// message as one.
if (this._incomingStream._dispatched) {
this.stats.rx.postExt += frame.payload.length;
}
if (frame.FIN) {

@@ -507,2 +525,3 @@ this._incomingStream = null;

frame = fromExtensionMessage(msg);
this.stats.rx.postExt += frame.payload.length;

@@ -558,2 +577,12 @@ switch (frame.opcode) {

// Calculate how long this frame would be as it stands now
// All frames are at least 2 bytes; byte 1 is FIN, RSV1-3, opcode; byte 2 is MASK bit, payload length
let preExtLength = 2 + frame.payload.length;
if (frame.maskKey) {
preExtLength += 4; // mask keys are always 4 bytes
}
preExtLength += getExtraPayloadLengthFieldSize(frame.payload.length);
this.stats.tx.preExt += preExtLength;
if (isControl || !frame.FIN || frame.opcode == 0) {

@@ -604,9 +633,4 @@ // https://github.com/faye/permessage-deflate-node/issues/6

size += 1; // MASK, payload length
size += getExtraPayloadLengthFieldSize(frame.payload.length);
if (frame.payload.length >= 126 && frame.payload.length <= 65535) {
size += 2; // 16-bit payload length
} else if (frame.payload.length > 65535) {
size += 8; // 64-bit payload length
}
if (frame.maskKey) {

@@ -651,4 +675,8 @@ size += 4;

// we're done building the buffer, so go ahead and convert it to a node Buffer
buf = buf.flip().toBuffer();
self.stats.tx.wire += buf.length;
if (bypassQueue) {
self._socket.write(buf.flip().toBuffer());
self._socket.write(buf);
} else if (queueId) {

@@ -658,9 +686,9 @@ // This already has a placeholder in the queue

if (idx == -1) {
self._outgoingFrames.push(buf.flip().toBuffer());
self._outgoingFrames.push(buf);
} else {
self._outgoingFrames[idx] = buf.flip().toBuffer();
self._outgoingFrames[idx] = buf;
}
} else {
// No queue placeholder, just stick it in
self._outgoingFrames.push(buf.flip().toBuffer());
self._outgoingFrames.push(buf);
}

@@ -800,1 +828,17 @@

}
function getFrameOverheadLength(frame) {
return 2 // byte 1 = FIN, RSV1-3, opcode; byte 2 = MASK flag, payload length
+ (frame.maskKey ? 4 : 0) // mask keys are always 4 bytes if present
+ getExtraPayloadLengthFieldSize(frame.payload.length);
}
function getExtraPayloadLengthFieldSize(payloadLength) {
if (payloadLength >= 126 && payloadLength <= 65535) {
return 2; // 16-bit payload length
} else if (payloadLength > 65535) {
return 8; // 64-bit payload length
} else {
return 0; // no extra payload length field
}
}

@@ -0,0 +0,0 @@ const Crypto = require('crypto');

@@ -0,0 +0,0 @@ exports.State = {

@@ -0,0 +0,0 @@ const Crypto = require('crypto');

@@ -0,0 +0,0 @@ const Stream = require('stream');

@@ -0,0 +0,0 @@ const ByteBuffer = require('bytebuffer');

2

package.json
{
"name": "websocket13",
"version": "2.2.0",
"version": "2.3.0",
"description": "Simple WebSocket protocol 13 client with no native or heavy dependencies",

@@ -5,0 +5,0 @@ "author": "Alex Corn <mckay@doctormckay.com>",

@@ -0,0 +0,0 @@ # WebSockets for Node.js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc