Real-Time Updates
How SSE delivers instant flag changes
Flipswitch uses Server-Sent Events (SSE) to push flag changes to connected clients instantly.
How It Works
- You toggle a flag in the dashboard
- Server broadcasts a
flag-changeevent to all connected SDKs - SDKs invalidate their local cache
- Next flag evaluation fetches the fresh value
The result: flag changes propagate in milliseconds, not minutes.
Why SSE?
Instant updates. Polling can take 30-60 seconds to detect changes. SSE delivers them immediately.
Kill switches that work. When something breaks, you need to disable features now, not "whenever the next poll happens."
Lower server load. One long-lived connection per client vs. constant polling requests.
Simple protocol. SSE is HTTP with a text/event-stream content type. Works through proxies, load balancers, and firewalls that understand HTTP.
SDK Behavior
All official SDKs support SSE by default:
When the SSE connection receives a flag-change event:
- The local cache is invalidated
- OpenFeature emits a
PROVIDER_CONFIGURATION_CHANGEDevent - If using React,
useFlaghooks re-render automatically
Connection Status
SDKs track connection state:
| Status | Meaning |
|---|---|
connecting | Establishing SSE connection |
connected | Receiving events |
disconnected | Connection lost, will retry |
error | Connection failed |
Reconnection
SDKs automatically reconnect with exponential backoff:
- Initial delay: 1 second
- Maximum delay: 30 seconds
- Backoff multiplier: 2x
While disconnected, the SDK continues working with cached values. When reconnected, it fetches fresh data.
Disabling SSE
If you don't need real-time updates:
Without SSE, flag changes only appear after the polling interval. Kill switches won't be instant.
Proxy Considerations
SSE requires long-lived HTTP connections. Some proxies and load balancers may close connections after a timeout.
If you see frequent disconnections:
- Configure your proxy to allow longer connection timeouts
- Check for intermediate proxies (CDNs, API gateways) that may buffer responses
- Ensure
Transfer-Encoding: chunkedis supported