Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker fans out events to live subscribers and replays recent history to resuming ones. A single mutex guards nextID, history, AND subscribers so that Publish and subscribeFrom are strictly serialized: an event is either captured in a new subscriber's replay snapshot (published before the subscribe critical section) or fanned out to it (published after) — never both (which would double-deliver and break the client's per-frame ACK) and never neither (the delivery gap this collapse closes). Do not reintroduce a second lock: the fan-out below runs inside the critical section and relies on being serialized against subscriber registration/removal.