peerix - v0.1.0
    Preparing search index...

    Class Driver

    Base class for signaling drivers.

    Drivers are responsible for sending and receiving signaling messages between peers. They should implement the subscribe, unsubscribe and dispatch methods to handle message routing based on namespaces.

    class MyDriver extends Driver {
    async subscribe(namespace, handler) {
    // subscribe to messages for the given namespace and call handler on message
    }

    async unsubscribe(namespace, handler) {
    // unsubscribe from messages for the given namespace and handler
    }

    async dispatch(namespace, message) {
    // dispatch a message to the given namespace
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    Constructors

    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>