engine.io-parser
Advanced tools
Comparing version 4.0.0-alpha.1 to 4.0.0
@@ -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 @@ |
@@ -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); |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18650
217
0
0