Logo FSBarV1_Archived

HubEvents Module

Central event bus for hub diagnostics and lifecycle signals. The hub publishes discrete events (session-state transitions, engine-speed adjustments, proxy-install step outcomes, scripting-client attach/detach, plain diagnostic lines). Consumers — the status bar, settings diagnostics pane, gRPC `GetSessionStatus` response assembly — observe the `IObservable` projection. Implementation is a single `System.Threading.Channels` pump with a list of subscribed `IObserver`s: the publish side enqueues without blocking, a background task drains the channel and fans out, and a slow observer cannot wedge the producer. No `System.Reactive` dependency.

Types

Type Description

AdminChannelStatus

Hub-visible admin-channel status (feature 039). Mirrors `FSBar.Hub.AdminChannelHost.AdminChannelStatus` — kept here so `HubEvent.AdminChannelStatusChanged` can reference it without pulling `AdminChannelHost` ahead of `HubEvents` in the compile order.

DetachReason

Why a scripting client's `StreamGameFrames` RPC was terminated by the hub (as opposed to a clean client-initiated disconnect).

HubEvent

Hub-wide event payload. Equality and comparison are opted out — feature 040 added cases carrying `VizConfig`, whose transitive `ColorScheme.MapValue` function field has no structural equality. Rather than forcing every downstream record to custom-equal, tests compare events by pattern-match + per-field check.

HubEventBus

The bus instance. Owned by `Program.fs`; constructed once per hub process. Disposing stops the pump task and completes all subscribed observers.

IHubEventSink

Inbound-only handle for modules that publish events. Taking this instead of a full `HubEventBus` reference in constructors makes the data flow unambiguous — modules that only publish cannot accidentally subscribe.

ProxyInstallStep

Discrete step of the proxy-installation flow, reported via `ProxyInstallProgress`.

SessionStateTag

Coarse session-state tag surfaced by `StateChanged`. Phase 2 scope: `SessionManager` does not yet exist, so this enum captures only the five lifecycle labels the status bar needs to render. Phase 3 enriches the situation by publishing richer context via additional `DiagnosticsLine` events and exposing the full state DU through `SessionManager.State`.

Severity

Diagnostic-line severity tag surfaced by `DiagnosticsLine`.

StepOutcome

Outcome of a single `ProxyInstallStep`.

Functions and values

Function or value Description

create ()

Full Usage: create ()

Parameters:
    () : unit

Returns: HubEventBus

Construct a fresh bus. The caller owns disposal.

() : unit
Returns: HubEventBus

Type something to start searching.