peerix - v0.1.0
    Preparing search index...

    Class MemoryDriver

    In-memory signaling driver for intra-process communication.

    This driver is useful for testing and debugging purposes, but is not suitable for production use due to its limitations (e.g. single-process scope).

    const driver = new MemoryDriver();
    

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Creates a new instance of the driver.

      Parameters

      • Optionaloptions: { delay?: number }

        Optional configuration for the driver.

        • Optionaldelay?: number

          Delay (in milliseconds) for message delivery to simulate network latency. The delay will be a random value between 75% and 125% of the specified delay.

      Returns MemoryDriver

    Accessors

    • 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

    Methods

    • Dispatches a signaling message to the specified namespace.

      Parameters

      • namespace: string[]

        The namespace to dispatch the message to.

      • message: Uint8Array

        The message to dispatch.

      Returns Promise<void>

    • Subscribes to signaling messages for the specified namespace.

      Parameters

      • namespace: string[]

        The namespace to subscribe to.

      • handler: (message: Uint8Array) => void

        The handler function to call when a message is received.

      Returns Promise<void>

    • Unsubscribes from signaling messages for the specified namespace.

      Parameters

      • namespace: string[]

        The namespace to unsubscribe from.

      • handler: (message: Uint8Array) => void

        The handler function to remove.

      Returns Promise<void>