You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

socket.io-parser

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.1 to 4.2.2

4

build/cjs/binary.js

@@ -24,3 +24,3 @@ "use strict";

return data;
if (is_binary_js_1.isBinary(data)) {
if ((0, is_binary_js_1.isBinary)(data)) {
const placeholder = { _placeholder: true, num: buffers.length };

@@ -58,3 +58,3 @@ buffers.push(data);

packet.data = _reconstructPacket(packet.data, buffers);
packet.attachments = undefined; // no longer useful
delete packet.attachments; // no longer useful
return packet;

@@ -61,0 +61,0 @@ }

@@ -8,3 +8,3 @@ "use strict";

const debug_1 = require("debug"); // debug()
const debug = debug_1.default("socket.io-parser"); // debug()
const debug = (0, debug_1.default)("socket.io-parser"); // debug()
/**

@@ -47,8 +47,11 @@ * Protocol version.

if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
if (is_binary_js_1.hasBinary(obj)) {
obj.type =
obj.type === PacketType.EVENT
if ((0, is_binary_js_1.hasBinary)(obj)) {
return this.encodeAsBinary({
type: obj.type === PacketType.EVENT
? PacketType.BINARY_EVENT
: PacketType.BINARY_ACK;
return this.encodeAsBinary(obj);
: PacketType.BINARY_ACK,
nsp: obj.nsp,
data: obj.data,
id: obj.id,
});
}

@@ -91,3 +94,3 @@ }

encodeAsBinary(obj) {
const deconstruction = binary_js_1.deconstructPacket(obj);
const deconstruction = (0, binary_js_1.deconstructPacket)(obj);
const pack = this.encodeAsString(deconstruction.packet);

@@ -127,4 +130,5 @@ const buffers = deconstruction.buffers;

packet = this.decodeString(obj);
if (packet.type === PacketType.BINARY_EVENT ||
packet.type === PacketType.BINARY_ACK) {
const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
// binary packet's json

@@ -142,3 +146,3 @@ this.reconstructor = new BinaryReconstructor(packet);

}
else if (is_binary_js_1.isBinary(obj) || obj.base64) {
else if ((0, is_binary_js_1.isBinary)(obj) || obj.base64) {
// raw binary data

@@ -260,2 +264,3 @@ if (!this.reconstructor) {

this.reconstructor.finishedReconstruction();
this.reconstructor = null;
}

@@ -291,3 +296,3 @@ }

// done with buffer list
const packet = binary_js_1.reconstructPacket(this.reconPack, this.buffers);
const packet = (0, binary_js_1.reconstructPacket)(this.reconPack, this.buffers);
this.finishedReconstruction();

@@ -294,0 +299,0 @@ return packet;

@@ -53,3 +53,3 @@ import { isBinary } from "./is-binary.js";

packet.data = _reconstructPacket(packet.data, buffers);
packet.attachments = undefined; // no longer useful
delete packet.attachments; // no longer useful
return packet;

@@ -56,0 +56,0 @@ }

@@ -44,7 +44,10 @@ import { Emitter } from "@socket.io/component-emitter";

if (hasBinary(obj)) {
obj.type =
obj.type === PacketType.EVENT
return this.encodeAsBinary({
type: obj.type === PacketType.EVENT
? PacketType.BINARY_EVENT
: PacketType.BINARY_ACK;
return this.encodeAsBinary(obj);
: PacketType.BINARY_ACK,
nsp: obj.nsp,
data: obj.data,
id: obj.id,
});
}

@@ -121,4 +124,5 @@ }

packet = this.decodeString(obj);
if (packet.type === PacketType.BINARY_EVENT ||
packet.type === PacketType.BINARY_ACK) {
const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
// binary packet's json

@@ -253,2 +257,3 @@ this.reconstructor = new BinaryReconstructor(packet);

this.reconstructor.finishedReconstruction();
this.reconstructor = null;
}

@@ -255,0 +260,0 @@ }

@@ -53,3 +53,3 @@ import { isBinary } from "./is-binary.js";

packet.data = _reconstructPacket(packet.data, buffers);
packet.attachments = undefined; // no longer useful
delete packet.attachments; // no longer useful
return packet;

@@ -56,0 +56,0 @@ }

@@ -41,7 +41,10 @@ import { Emitter } from "@socket.io/component-emitter";

if (hasBinary(obj)) {
obj.type =
obj.type === PacketType.EVENT
return this.encodeAsBinary({
type: obj.type === PacketType.EVENT
? PacketType.BINARY_EVENT
: PacketType.BINARY_ACK;
return this.encodeAsBinary(obj);
: PacketType.BINARY_ACK,
nsp: obj.nsp,
data: obj.data,
id: obj.id,
});
}

@@ -117,4 +120,5 @@ }

packet = this.decodeString(obj);
if (packet.type === PacketType.BINARY_EVENT ||
packet.type === PacketType.BINARY_ACK) {
const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
// binary packet's json

@@ -248,2 +252,3 @@ this.reconstructor = new BinaryReconstructor(packet);

this.reconstructor.finishedReconstruction();
this.reconstructor = null;
}

@@ -250,0 +255,0 @@ }

{
"name": "socket.io-parser",
"version": "4.2.1",
"version": "4.2.2",
"description": "socket.io protocol parser",

@@ -29,14 +29,17 @@ "repository": {

"@babel/preset-env": "~7.9.6",
"@babel/register": "^7.18.9",
"@types/debug": "^4.1.5",
"@types/node": "^14.11.1",
"babelify": "~10.0.0",
"@wdio/cli": "^7.26.0",
"@wdio/local-runner": "^7.26.0",
"@wdio/mocha-framework": "^7.26.0",
"@wdio/sauce-service": "^7.26.0",
"@wdio/spec-reporter": "^7.26.0",
"benchmark": "2.1.2",
"expect.js": "0.3.1",
"mocha": "3.2.0",
"mocha": "^10.1.0",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"socket.io-browsers": "^1.0.0",
"typescript": "^4.0.3",
"zuul": "3.11.1",
"zuul-ngrok": "4.0.0"
"wdio-geckodriver-service": "^4.0.0"
},

@@ -47,5 +50,5 @@ "scripts": {

"test:node": "mocha --reporter dot --bail test/index.js",
"test:browser": "zuul test/index.js --no-coverage",
"format:fix": "prettier --write --parser typescript 'lib/**/*.ts' 'test/**/*.js'",
"format:check": "prettier --check --parser typescript 'lib/**/*.ts' 'test/**/*.js'",
"test:browser": "wdio",
"format:fix": "prettier --write --parser typescript '*.js' 'lib/**/*.ts' 'test/**/*.js'",
"format:check": "prettier --check --parser typescript '*.js' 'lib/**/*.ts' 'test/**/*.js'",
"prepack": "npm run compile"

@@ -52,0 +55,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc