@@ -112,9 +112,7 @@ export class Socket extends EventEmitter {
112
112
113
113
if ( this . protocol === 3 ) {
114
114
// in protocol v3, the client sends a ping, and the server answers with a pong
115
- this . resetPingTimeout (
116
- this . server . opts . pingInterval + this . server . opts . pingTimeout
117
- ) ;
115
+ this . resetPingTimeout ( ) ;
118
116
} else {
119
117
// in protocol v4, the server sends a ping, and the client answers with a pong
120
118
this . schedulePing ( ) ;
@@ -193,7 +191,7 @@ export class Socket extends EventEmitter {
193
191
this . server . opts . pingTimeout
194
192
) ;
195
193
this . sendPacket ( "ping" ) ;
196
- this . resetPingTimeout ( this . server . opts . pingTimeout ) ;
194
+ this . resetPingTimeout ( ) ;
197
195
} , this . server . opts . pingInterval ) ;
198
196
}
199
197
@@ -202,12 +200,17 @@ export class Socket extends EventEmitter {
202
200
*
203
201
* @api private
204
202
*/
205
- private resetPingTimeout ( timeout ) {
203
+ private resetPingTimeout ( ) {
206
204
clearTimeout ( this . pingTimeoutTimer ) ;
207
- this . pingTimeoutTimer = setTimeout ( ( ) => {
208
- if ( this . readyState === "closed" ) return ;
209
- this . onClose ( "ping timeout" ) ;
210
- } , timeout ) ;
205
+ this . pingTimeoutTimer = setTimeout (
206
+ ( ) => {
207
+ if ( this . readyState === "closed" ) return ;
208
+ this . onClose ( "ping timeout" ) ;
209
+ } ,
210
+ this . protocol === 3
211
+ ? this . server . opts . pingInterval + this . server . opts . pingTimeout
212
+ : this . server . opts . pingTimeout
213
+ ) ;
211
214
}
212
215
213
216
/**
0 commit comments