Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 088dcb4

Browse filesBrowse files
feat: add the "maxPayload" field in the handshake details
So that clients in HTTP long-polling can decide how many packets they have to send to stay under the maxHttpBufferSize value. This is a backward compatible change which should not mandate a new major revision of the protocol (we stay in v4), as we only add a field in the JSON-encoded handshake data: ``` 0{"sid":"lv_VI97HAXpY6yYWAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000,"maxPayload":1000000} ``` Related: socketio/socket.io-client#1531
1 parent 657f04e commit 088dcb4
Copy full SHA for 088dcb4

File tree

Expand file treeCollapse file tree

2 files changed

+5
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-3
lines changed
Open diff view settings
Collapse file

‎lib/socket.ts‎

Copy file name to clipboardExpand all lines: lib/socket.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export class Socket extends EventEmitter {
9090
sid: this.id,
9191
upgrades: this.getAvailableUpgrades(),
9292
pingInterval: this.server.opts.pingInterval,
93-
pingTimeout: this.server.opts.pingTimeout
93+
pingTimeout: this.server.opts.pingTimeout,
94+
maxPayload: this.server.opts.maxHttpBufferSize
9495
})
9596
);
9697

Collapse file

‎test/server.js‎

Copy file name to clipboardExpand all lines: test/server.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ describe("server", () => {
449449
expect(obj.sid).to.be.a("string");
450450
expect(obj.pingTimeout).to.be.a("number");
451451
expect(obj.upgrades).to.be.an("array");
452+
expect(obj.maxPayload).to.eql(1000000);
452453
done();
453454
});
454455
});
@@ -3356,7 +3357,7 @@ describe("server", () => {
33563357
expect(res.headers["set-cookie"].length).to.be(2);
33573358
expect(res.headers["set-cookie"][1]).to.be("mycookie=456");
33583359

3359-
const sid = JSON.parse(res.text.substring(4)).sid;
3360+
const sid = JSON.parse(res.text.substring(5)).sid;
33603361

33613362
request
33623363
.post(`http://localhost:${port}/engine.io/`)
@@ -3393,7 +3394,7 @@ describe("server", () => {
33933394
expect(res.headers["set-cookie"].length).to.be(2);
33943395
expect(res.headers["set-cookie"][1]).to.be("mycookie=456");
33953396

3396-
const sid = JSON.parse(res.text.substring(4)).sid;
3397+
const sid = JSON.parse(res.text.substring(5)).sid;
33973398

33983399
request
33993400
.post(`http://localhost:${port}/engine.io/`)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.