SSE
Planned APIs: This page documents the final SSE workflow.
commflow@0.0.2does not export an SSE runtime; do not use its imports as current production imports. See Current Release Quick Start for runnable exports.
When To Use It
SSE fits server-to-client event delivery:
Create An SSE Client
Subscribe To Events
The returned stream must expose a close operation so users can release the connection on unmount, service shutdown, or task completion.
Handle Event Types
Prefer structured event types instead of treating every event as an untyped string.
Auth And Last-Event-ID
Reconnect Policy
An SSE disconnect is not always business failure; it may be a short network interruption.
State model:
Close And Cleanup
Always release the stream when:
- a frontend component unmounts;
- a server request lifecycle ends;
- user switches tenant, project, or topic;
- a task completes and progress events are no longer needed.
Error Handling
SSE errors should be distinguishable:
See Errors And Retries for the broader error model.
When Not To Use SSE
If you need continuous client-to-server messages, rooms, binary data, or strongly interactive realtime channels, use Socket instead of emulating a duplex protocol with SSE.