peerix - v0.6.0
    Preparing search index...

    Class BroadcastChannelDriver

    BroadcastChannel-based signaling driver for intra-origin communication.

    This driver uses the BroadcastChannel API to relay signaling messages between browser contexts (e.g., tabs, windows, iframes) that share the same origin.

    It is useful for testing and debugging purposes, but is not suitable for production use due to its limitations (e.g., same-origin restrictions).

    const driver = new BroadcastChannelDriver("peerix");
    

    Hierarchy (View Summary)

    • Driver
      • BroadcastChannelDriver
    Index
    • get active(): boolean

      Indicates whether the driver is currently active.

      Returns boolean

    • set active(value: boolean): void

      Sets the active state of the driver and emits corresponding events.

      Parameters

      • value: boolean

      Returns void

    • Publishes a signaling message to the specified namespace.

      Parameters

      • namespace: string

        The namespace to publish the message to.

      • data: number[]

        The message data to publish.

      Returns Promise<void>

      Nothing directly; resolves once the message is delivered (async drivers may return a promise).

    • Subscribes to signaling messages for the specified namespace.

      Parameters

      • namespace: string

        The namespace to subscribe to.

      • handler: (data: number[]) => void

        The handler function to call when a message is received.

      Returns Promise<void>

      Nothing directly; resolves once the subscription is established (async drivers may return a promise).

    • Unsubscribes from signaling messages for the specified namespace.

      Parameters

      • namespace: string

        The namespace to unsubscribe from.

      • handler: (data: number[]) => void

        The handler function to remove.

      Returns Promise<void>

      Nothing directly; resolves once the unsubscription is confirmed (async drivers may return a promise).