@@ -112,9 +112,7 @@ export class Socket extends EventEmitter {
112112
113113 if ( this . protocol === 3 ) {
114114 // 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 ( ) ;
118116 } else {
119117 // in protocol v4, the server sends a ping, and the client answers with a pong
120118 this . schedulePing ( ) ;
@@ -193,7 +191,7 @@ export class Socket extends EventEmitter {
193191 this . server . opts . pingTimeout
194192 ) ;
195193 this . sendPacket ( "ping" ) ;
196- this . resetPingTimeout ( this . server . opts . pingTimeout ) ;
194+ this . resetPingTimeout ( ) ;
197195 } , this . server . opts . pingInterval ) ;
198196 }
199197
@@ -202,12 +200,17 @@ export class Socket extends EventEmitter {
202200 *
203201 * @api private
204202 */
205- private resetPingTimeout ( timeout ) {
203+ private resetPingTimeout ( ) {
206204 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+ ) ;
211214 }
212215
213216 /**
0 commit comments