Documentation
¶
Overview ¶
Package observer turns the engine's ObserverEvent callback into a loopback-served SSE stream — the SHN Kit flow inspector's data source. A ring buffer (last bufSize events) gives late/reconnecting subscribers replay via Last-Event-ID; live delivery is per-subscriber buffered and LOSSY under backpressure (a slow consumer misses events and re-syncs from the buffer on reconnect — the stream is diagnostic, never load-bearing for exchange correctness).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub fan-outs observer events to SSE subscribers. Zero value is not usable; call NewHub.
func (*Hub) Emit ¶
func (h *Hub) Emit(e engine.ObserverEvent)
Emit assigns the next seq, buffers, and fans out. Assign to engine.Config.Observer. NEVER drops an event for its payload: a payload snapshot is the raw bytes seen at the edge, and a malformed ingress body — the classic 400 case — is exactly the failure the inspector must show, but invalid JSON in a json.RawMessage makes json.Marshal fail. Non-JSON payloads are re-encoded as a JSON string and flagged in Detail.