Socket
Socket
Sign inDemoInstall

socket.io-parser

Package Overview
Dependencies
3
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.0.1-rc1

12

CHANGELOG.md

@@ -0,1 +1,13 @@

## [4.0.1-rc1](https://github.com/socketio/socket.io-parser/compare/4.0.0...4.0.1-rc1) (2020-10-12)
### Features
* add support for a payload in a CONNECT packet ([78f9fc2](https://github.com/socketio/socket.io-parser/commit/78f9fc2999b15804b02f2c22a2b4007734a26af9))
## [3.3.1](https://github.com/socketio/socket.io-parser/compare/3.3.0...3.3.1) (2020-09-30)
# [4.0.0](https://github.com/socketio/socket.io-parser/compare/3.4.1...4.0.0) (2020-09-28)

@@ -2,0 +14,0 @@

1

dist/index.d.ts

@@ -67,2 +67,3 @@ import Emitter from "component-emitter";

private decodeString;
private static isPayloadValid;
/**

@@ -69,0 +70,0 @@ * Deallocates a parser's resources

23

dist/index.js

@@ -10,4 +10,3 @@ "use strict";

const is_binary_1 = __importDefault(require("./is-binary"));
const debug_1 = __importDefault(require("debug"));
const debug = debug_1.default("socket.io-parser");
const debug = require("debug")("socket.io-parser");
/**

@@ -200,5 +199,3 @@ * Protocol version.

const payload = tryParse(str.substr(i));
const isPayloadValid = payload !== false &&
(p.type === PacketType.ERROR || Array.isArray(payload));
if (isPayloadValid) {
if (Decoder.isPayloadValid(p.type, payload)) {
p.data = payload;

@@ -213,2 +210,18 @@ }

}
static isPayloadValid(type, payload) {
switch (type) {
case PacketType.CONNECT:
return typeof payload === "object";
case PacketType.DISCONNECT:
return payload === undefined;
case PacketType.ERROR:
return typeof payload === "string";
case PacketType.EVENT:
case PacketType.BINARY_EVENT:
return Array.isArray(payload) && typeof payload[0] === "string";
case PacketType.ACK:
case PacketType.BINARY_ACK:
return Array.isArray(payload);
}
}
/**

@@ -215,0 +228,0 @@ * Deallocates a parser's resources

{
"name": "socket.io-parser",
"version": "4.0.0",
"version": "4.0.1-rc1",
"description": "socket.io protocol parser",

@@ -39,3 +39,4 @@ "repository": {

"format:fix": "prettier --write --parser typescript 'lib/**/*.ts' 'test/**/*.js'",
"format:check": "prettier --check --parser typescript 'lib/**/*.ts' 'test/**/*.js'"
"format:check": "prettier --check --parser typescript 'lib/**/*.ts' 'test/**/*.js'",
"prepack": "tsc"
},

@@ -42,0 +43,0 @@ "license": "MIT",

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