prsm/packages/keepalive-ws/src/server/latency.ts
2024-08-27 18:16:34 -04:00

16 lines
238 B
TypeScript

export class Latency {
start = 0;
end = 0;
ms = 0;
interval: ReturnType<typeof setTimeout>;
onRequest() {
this.start = Date.now();
}
onResponse() {
this.end = Date.now();
this.ms = this.end - this.start;
}
}