Keep active transfers connected when the app returns to foreground (#8651)

* fix(client): keep active transfers alive during foreground checks

Foreground used an independent three-second probe that closed live connections while a pong waited behind bulk data. Share the heartbeat clock and refresh its outstanding deadline on validated inbound frames, including incomplete chunk assemblies.

* test(client): deliver bulk response before the queued pong

* fix(client): preserve latency deadlines when sharing heartbeat pings

* fix(client): keep heartbeat cadence during active downloads
This commit is contained in:
Mohamed Boudra
2026-11-05 20:57:13 +07:00
committed by GitHub
parent e6064bb374
commit 412550c36f
3 changed files with 199 additions and 43 deletions
@@ -25,6 +25,7 @@ export class ChunkedTransport {
supportsDrain?: boolean;
send: (frame: Frame, waitForDrain: boolean) => void | Promise<void>;
deliver: (frame: Frame) => void;
onActivity?: () => void;
onFailure?: (error: unknown) => void;
},
) {
@@ -134,6 +135,7 @@ export class ChunkedTransport {
{ cause: error },
);
}
this.io.onActivity?.();
if (message !== undefined) this.io.deliver(message);
}