Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitf55a79a

Browse files
feat: increase the default value of pingTimeout
This value was updated from 60000 to 5000 in [1], included in`engine.io@3.2.0` (Feb 2018).The reasoning back then:Some users experienced long delays between disconnection on theserver-side and on the client-side. The "disconnect" event would take along time to fire in the browser, probably due to a timer beingdelayed. Hence the change.That being said, the current value (5s) now causes unexpecteddisconnections when a big payload is sent over a slow network, becauseit prevents the ping-pong packets from being exchanged between theclient and the server. This can also happen when a synchronous taskblocks the server for more than 5 seconds.The new value (20s) thus seems like a good balance between quickdisconnection detection and tolerance to various delays.Note: pingInterval + pingTimeout is still below the threshold of ReactNative, which complains if a timer is set with a delay of more than 1minute.[1]:65b1ad1Related:-socketio/socket.io#2770-socketio/socket.io#2769-socketio/socket.io#3054-socketio/socket.io#3376Backported from5a7fa13
1 parent1f5d469 commitf55a79a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ to a single process.
221221
-`Object`: optional, options object
222222
-**Options**
223223
-`pingTimeout` (`Number`): how many ms without a pong packet to
224-
consider the connection closed (`5000`)
224+
consider the connection closed (`20000`)
225225
-`pingInterval` (`Number`): how many ms before sending a new ping
226226
packet (`25000`)
227227
-`upgradeTimeout` (`Number`): how many ms before an uncompleted transport upgrade is cancelled (`10000`)

‎lib/server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function Server (opts) {
3737
opts=opts||{};
3838

3939
this.wsEngine=opts.wsEngine||process.env.EIO_WS_ENGINE||'ws';
40-
this.pingTimeout=opts.pingTimeout||5000;
40+
this.pingTimeout=opts.pingTimeout||20000;
4141
this.pingInterval=opts.pingInterval||25000;
4242
this.upgradeTimeout=opts.upgradeTimeout||10000;
4343
this.maxHttpBufferSize=opts.maxHttpBufferSize||1e6;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp