diff options
| author | Osmium Sorcerer <os@sof.beauty> | 2026-03-16 14:12:22 +0000 |
|---|---|---|
| committer | Osmium Sorcerer <os@sof.beauty> | 2026-04-18 16:52:22 +0000 |
| commit | 2ef41402209b82279656ae4b1affe6484be1ed77 (patch) | |
| tree | aba1f661a3400d1e2230c639af14fa20fb6bfecf /webAO/client.ts | |
| parent | a7e664d5527dac59d722cdb48bfd8e3edf86645f (diff) | |
Remove CH-sending timer
CH is an application-level keepalive packet that clients periodically
send for two reasons:
1. It tells the server they're still connected, preventing timeouts.
2. By measuring latency between sending CH and receiving CHECK, a client
can display ping.
Keepalive is redundant because WebSocket can handle that via PING frames on a
transport layer. WebAO also completely ignores CHECK and sends CH every
five seconds, which is superfluous (AO2 Client sends it once every 45
seconds, in comparison).
Sending CH via `setInterval` was also problematic: browsers seem to
throttle it when the tab becomes inactive, preventing periodic pings and
leading to the server disconnecting inactive browser clients.
Diffstat (limited to 'webAO/client.ts')
| -rw-r--r-- | webAO/client.ts | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/webAO/client.ts b/webAO/client.ts index 703ce73..0699f6b 100644 --- a/webAO/client.ts +++ b/webAO/client.ts @@ -145,7 +145,6 @@ class Client extends EventEmitter { selectedEmote: number; selectedEvidence: number; sender: ISender; - checkUpdater: any; _lastTimeICReceived: any; viewport: Viewport; partial_packet: boolean; @@ -209,7 +208,6 @@ class Client extends EventEmitter { this.resources = getResources(AO_HOST, theme); this.selectedEmote = -1; this.selectedEvidence = -1; - this.checkUpdater = null; this.sender = sender; this.viewport = masterViewport(); this._lastTimeICReceived = new Date(0); @@ -268,9 +266,6 @@ class Client extends EventEmitter { document.getElementById("client_charselect").remove(); document.getElementById("client_ooc").remove(); } - if (mode !== "replay") { - this.checkUpdater = setInterval(() => this.sender.sendCheck(), 5000); - } } /** @@ -386,12 +381,8 @@ class Client extends EventEmitter { this.cleanup(); } - /** - * Stop sending keepalives to the server. - */ cleanup() { - clearInterval(this.checkUpdater); - if (this.serv) this.serv.close(); + this.serv.close(); } /** |
