If a service stays silent for minutes and a proxy times out, choose what the client should receive before adding heartbeat bytes. Extending a timer can help one wait; the response contract determines what progress is valid.

Application designProgress contract
Asynchronous job202 Accepted with a representation describing monitoring, followed by finite status requests and explicit completion/failure states
Server-Sent Events streamContent-Type: text/event-stream and records the SSE client understands

202 does not promise that the job succeeds. For SSE, a comment record can look like:

: heartbeat

The colon makes it a comment rather than an application event. HTML's authoring notes suggest periodic comments roughly every 15 seconds against some legacy proxy idle behavior; that is guidance, not a universal timeout guarantee.

Finish headers and ensure the application/serving stack releases records rather than buffering them locally. Bytes not yet sent cannot keep a downstream intermediary active.

Do not insert SSE comments into ordinary JSON or binary content. An HTTP/1.1 zero-length chunk ends a chunked body, so it is not a repeatable empty heartbeat.

Retain an operation deadline and cancellation policy. Traffic activity alone does not show useful job progress or a valid final result.

Tënë sô zo