IStreamObserver via NexusConfig.Observer to receive structured callbacks for every SSE lifecycle transition. The observer is the canonical way to wire SDK state into ops dashboards, custom telemetry, or load-test tooling - far more reliable than scraping log output by substring match.
The observer is opt-in. When NexusConfig.Observer is null the SDK uses its no-op observer at zero overhead. On the dependency-injection path, register it in the container instead: services.AddSingleton<IStreamObserver, MyObserver>().
The interface
Hook semantics
OnFallback reasons
For every reason except
ServiceLocked, the SDK reconnects on its own and a later OnConnected() confirms the stream is back.
See SSE live updates for the connection limits.
Threading contract
If your observer does anything substantial (network I/O, lock contention, disk writes), copy the argument and dispatch the work to your own pipeline before returning:Counter pattern
Active-connection gauge pattern
false from the moment the stream drops until the SDK’s own reconnect fires
OnConnected() again - the same answer NexusClient.IsStreamConnected gives, for a health check
that only needs to read it.
