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

    Interface MessageQueue<T>

    Buffer for messages produced while a Transport is offline, flushed in FIFO order once the connection is (re)established. Implement this interface to supply a custom buffering policy via TransportOptions.sendQueue.

    interface MessageQueue<T> {
        size: number;
        clear(): void;
        drain(send: (item: T) => void): void;
        enqueue(item: T): boolean;
    }

    Type Parameters

    Implemented by

    Index

    Properties

    Methods

    Properties

    size: number

    Number of messages currently buffered.

    Methods

    • Sends and removes every buffered message in FIFO order via send.

      Parameters

      • send: (item: T) => void

      Returns void

    • Appends a message to the queue.

      Parameters

      • item: T

      Returns boolean

      true if buffered, false if the queue was full and the message was dropped.