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

    Class HashRingStrategy

    PlacementStrategy that pins a key to a node via consistent hashing.

    Preferring the given region, it maps the routing key (e.g. a room id) onto a capacity-weighted HashRing so the same key consistently lands on the same node while the node set is stable, and only minimally reshuffles when nodes join or leave. The ring is rebuilt only when the candidate pool's id/weight signature changes. With no key, it falls back to the first candidate.

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Select a node from the candidate set.

      Parameters

      • candidates: SfuNode[]

        Eligible nodes to choose from.

      • Optionalregion: string

        Optional preferred region; strategies typically restrict selection to nodes in this region when any exist, otherwise fall back to the full set.

      • Optionalkey: string

        Optional routing key (for example the room id) used by deterministic strategies to map the same key to the same node.

      Returns SfuNode | undefined

      The selected node, or undefined when candidates is empty.