RTCForge API Reference v1.1.1
    Preparing search index...

    Interface SfuClusterOptions

    Construction options for an SfuCluster.

    interface SfuClusterOptions {
        healthCheck?: {
            failureThreshold?: number;
            intervalMs?: number;
            onCheck?: (nodeId: string) => Promise<boolean>;
            probeTimeoutMs?: number;
            recoveryThreshold?: number;
        };
        logger?: Logger;
        membership?: Membership;
        nodeFactory?: (info: NodeInfo) => SfuNode;
        onRebalance?: (fromNodeId: string, reason: "failed" | "draining") => void;
        placementStrategy?: PlacementStrategy;
    }
    Index

    Properties

    healthCheck?: {
        failureThreshold?: number;
        intervalMs?: number;
        onCheck?: (nodeId: string) => Promise<boolean>;
        probeTimeoutMs?: number;
        recoveryThreshold?: number;
    }

    Active health-check configuration. When onCheck is provided, SfuCluster.startHealthChecks polls each node on an interval and marks it failed (triggering a rebalance) when the check returns false.

    Type Declaration

    • OptionalfailureThreshold?: number

      Consecutive failed sweeps required before a node is marked failed. Higher values suppress flapping from a single transient timeout.

      3

    • OptionalintervalMs?: number

      Interval between health-check sweeps, in milliseconds.

      30000
      
    • OptionalonCheck?: (nodeId: string) => Promise<boolean>

      Probe returning whether the node with nodeId is currently healthy.

    • OptionalprobeTimeoutMs?: number

      Milliseconds a single probe may run before being treated as failed. Guards against a hung probe wedging a node.

      intervalMs

    • OptionalrecoveryThreshold?: number

      Consecutive passing sweeps required before a failed node is marked recovered.

      2

    logger?: Logger

    Logger used for cluster-level diagnostics. Defaults to a no-op logger.

    membership?: Membership

    Optional membership source. When provided, the cluster reconciles its node set against it automatically, adding and removing nodes as membership changes.

    nodeFactory?: (info: NodeInfo) => SfuNode

    Factory that builds an SfuNode from membership NodeInfo. Only used when SfuClusterOptions.membership is set.

    a factory creating new SfuNode(info.id, info.region ?? 'default')

    onRebalance?: (fromNodeId: string, reason: "failed" | "draining") => void

    Callback invoked for each drained or failed node during a rebalance, so the host can migrate that node's rooms elsewhere.

    placementStrategy?: PlacementStrategy

    Node-selection policy used by SfuCluster.assignNode.

    a new LeastLoadedStrategy