Skip to content

Commit 3512f7b

Browse files
committed
Use Date.now because performance.now is also throttled
1 parent 6f5792f commit 3512f7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/engine.io-client/lib/socket.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ export class SocketWithoutUpgrade extends Emitter<
630630
private _resetPingTimeout() {
631631
this.clearTimeoutFn(this._pingTimeoutTimer);
632632
const delay = this._pingInterval + this._pingTimeout
633-
this._pingTimeoutTime = performance.now() + delay
633+
this._pingTimeoutTime = Date.now() + delay
634634
this._pingTimeoutTimer = this.setTimeoutFn(() => {
635635
this._onClose("ping timeout");
636636
}, delay);
@@ -722,7 +722,7 @@ export class SocketWithoutUpgrade extends Emitter<
722722
return
723723
}
724724

725-
const expired = performance.now() >= this._pingTimeoutTime
725+
const expired = Date.now() >= this._pingTimeoutTime
726726
if (expired) {
727727
debug("`checkHeartbeat` detected missed ping so closing connection");
728728
this._onClose("ping timeout");

0 commit comments

Comments
 (0)