- Distinguish connected, reconnecting, complete, and failed states.
- Use event identity and server state to recover without duplicates.
- Streaming a response does not establish that the underlying operation finished.
Live updates create a continuity promise
A dashboard begins showing progress as soon as a job starts. A research assistant reveals an answer a little at a time. A queue monitor updates without asking the reader to refresh. These experiences can feel more responsive than waiting for one final response, but they also make a promise: the visible stream reflects an operation that is still understood by the application. When the connection drops, that promise needs a defined recovery path. Otherwise, an animated interface can remain confidently wrong about work that has stopped or already completed.
Server-sent events provide a browser mechanism for receiving a stream of events from a server. MDN documents the EventSource interface, the text/event-stream format, event names, identifiers, and reconnection-related behavior. Those platform features are the starting point. The application must decide what each event means, how long server state is retained, and how the interface reconciles after an interruption. A transport feature can carry progress, but it does not define the business meaning of progress on its own.
Describe states that a person can recognize
A useful interface distinguishes waiting to connect, receiving updates, reconnecting, successfully completed, canceled, and failed. These states do not all require prominent banners, but they should produce appropriate behavior. A reconnecting stream should not continue to display a message that implies new information is arriving. A completed operation should not look indefinitely busy. A failed operation should preserve any useful result and explain what the user can do next. State clarity matters more than a decorative loading animation.
For a hypothetical document-conversion service, the progress stream might report that an upload was accepted, conversion began, and a result became available. The final result should have a durable identifier the client can retrieve independently. If the stream ends unexpectedly after conversion succeeds, the client can check that result rather than restart the whole job. This separates the operation’s state from the connection’s state. The distinction prevents a transient network problem from becoming an unnecessary duplicate conversion or a misleading failure message.
Event identifiers help only when the server can use them
An event identifier can support reconnection, but the application needs a policy for retained history and replay. Decide whether a reconnecting client receives missed events, a fresh snapshot, or an instruction to reload current state. Each approach can be appropriate for a different workload. A rapidly changing stock display may prefer a current snapshot, while a job-progress log may need ordered events. The client should not infer that an identifier automatically means the server can reproduce every earlier message indefinitely.
Design event handling to tolerate repetition where the protocol and application can deliver it. If an event means set the progress to this value, processing it twice may be harmless. If it means increment a counter, repetition changes the result. Prefer event meanings that are easy to reconcile with authoritative state, or include enough identity for the client to recognize already processed work. This is especially important when an event triggers a visible side effect, such as appending a record or offering a completed download.
Intermediaries can change the apparent stream
A server may emit small events promptly while a proxy or hosting layer buffers them. The reader then receives updates in bursts and the feature appears to work only intermittently. Test the deployed path, including the platform and any reverse proxy, rather than relying solely on a local development server. Inspect whether the expected response type and connection behavior survive each layer. Keep the test representative of the event size and frequency the application will actually use.
Timeouts also belong in the design. A quiet job can leave a connection open without sending a meaningful update for some time. The platform may require a supported keep-alive pattern, while the application still needs a separate notion of whether the job is making progress. A transport heartbeat should not be displayed as evidence that useful work is advancing. Distinguish connection liveness from operation health so a responsive server cannot indefinitely mask a stalled background task.
Cancellation and authorization must remain meaningful
Closing a browser stream does not necessarily stop the underlying operation. If the product offers cancel, define whether it cancels only the display, requests cancellation of the job, or confirms that the job has stopped. The server may need a separate endpoint and an explicit result. The interface should avoid reporting canceled until it knows what that word means for the operation. This matters when work consumes resources, changes state, or creates a file that may remain available after the tab closes.
Authorization should apply to the stream and to any durable result it references. An event that contains a sensitive download URL can create a disclosure path if the URL is broadly usable. If a user’s access changes during a long-running job, the application needs an intentional policy for future events and result retrieval. Do not assume that authenticating when the connection opens resolves every later decision. The appropriate checks depend on the service, but the relationship between job ownership and result access should be explicit.
Limit what is included in event logs. Debugging often encourages teams to record every message, yet a stream can contain user content, internal identifiers, or partial results. Retain the information needed to investigate ordering and failures without copying sensitive payloads into broadly accessible logs. A job identifier, event sequence, type, and timing can support many operational questions. Review payload retention separately from transport diagnostics.
Test recovery as a primary feature
A practical test plan interrupts the connection before the first event, during progress, and immediately after server completion. It also includes two tabs viewing the same job, a user leaving and returning, and a result that expires. Observe whether the interface converges on the authoritative state without duplicates or lost access. The happy path is important, but these transitions determine whether the stream remains useful on the unreliable networks people actually use.
Server-sent events can be a good fit for one-way live updates because the browser provides a straightforward receiving model. The product still needs a coherent lifecycle around the connection. Define event meaning, preserve durable operation state, handle replay deliberately, and make interruptions visible. A trustworthy streaming interface is not one that never disconnects. It is one that can explain what happened to the work and recover to the correct state when the connection inevitably changes.
Sources & further reading
Primary references inform the reporting. Our explanations, scenarios, and conclusions are editorial analysis; source statements are not independent test results.
- MDN: Using server-sent eventsdeveloper.mozilla.org
- MDN: Server-sent eventsdeveloper.mozilla.org
Source publication or reference date: 2026-11-04.
See an error or an important update? Contact the editors.



