Socket
Socket
Sign inDemoInstall

engine.io-parser

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-parser - npm Package Compare versions

Comparing version 4.0.0-alpha.1 to 4.0.0

39

CHANGELOG.md

@@ -0,1 +1,40 @@

# [4.0.0](https://github.com/socketio/engine.io-parser/compare/v4.0.0-alpha.1...v4.0.0) (2020-09-08)
This major release contains the necessary changes for the version 4 of the Engine.IO protocol. More information about the new version can be found [there](https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4).
Encoding changes between v3 and v4:
- encodePacket with string
- input: `{ type: "message", data: "hello" }`
- output in v3: `"4hello"`
- output in v4: `"4hello"`
- encodePacket with binary
- input: `{ type: 'message', data: <Buffer 01 02 03> }`
- output in v3: `<Buffer 04 01 02 03>`
- output in v4: `<Buffer 01 02 03>`
- encodePayload with strings
- input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: '€€€' } ]`
- output in v3: `"6:4hello4:4€€€"`
- output in v4: `"4hello\x1e4€€€"`
- encodePayload with string and binary
- input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: <Buffer 01 02 03> } ]`
- output in v3: `<Buffer 00 06 ff 34 68 65 6c 6c 6f 01 04 ff 04 01 02 03>`
- output in v4: `"4hello\x1ebAQID"`
Please note that the parser is now dependency-free! This should help reduce the size of the browser bundle.
### Bug Fixes
* keep track of the buffer initial length ([8edf2d1](https://github.com/socketio/engine.io-parser/commit/8edf2d1478026da442f519c2d2521af43ba01832))
### Features
* restore the upgrade mechanism ([6efedfa](https://github.com/socketio/engine.io-parser/commit/6efedfa0f3048506a4ba99e70674ddf4c0732e0c))
# [4.0.0-alpha.1](https://github.com/socketio/engine.io-parser/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2020-05-19)

@@ -2,0 +41,0 @@

2

lib/commons.js

@@ -7,2 +7,4 @@ const PACKET_TYPES = Object.create(null); // no Map = no polyfill

PACKET_TYPES["message"] = "4";
PACKET_TYPES["upgrade"] = "5";
PACKET_TYPES["noop"] = "6";

@@ -9,0 +11,0 @@ const PACKET_TYPES_REVERSE = Object.create(null);

6

lib/index.js

@@ -7,3 +7,5 @@ const encodePacket = require("./encodePacket");

const encodePayload = (packets, callback) => {
const encodedPackets = new Array(packets.length);
// some packets may be added to the array while encoding, so the initial length must be saved
const length = packets.length;
const encodedPackets = new Array(length);
let count = 0;

@@ -15,3 +17,3 @@

encodedPackets[i] = encodedPacket;
if (++count === packets.length) {
if (++count === length) {
callback(encodedPackets.join(SEPARATOR));

@@ -18,0 +20,0 @@ }

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "4.0.0-alpha.1",
"version": "4.0.0",
"main": "lib/index.js",

@@ -8,0 +8,0 @@ "homepage": "https://github.com/socketio/engine.io-parser",

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