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

    Interface MessageBus

    Publish/subscribe message bus keyed by topic.

    This is the seam RTCForge uses to fan out messages (for example, broadcasting across nodes). The default in-process implementation is LocalMessageBus; production deployments can supply an adapter backed by Redis Pub/Sub, NATS, or similar. Messages are untyped (unknown) and it is the caller's responsibility to serialize and validate payloads.

    interface MessageBus {
        publish(topic: string, message: unknown): Promise<void>;
        subscribe(topic: string, handler: (message: unknown) => void): Unsubscribe;
    }

    Implemented by

    Index

    Methods

    • Publishes message to all current subscribers of topic.

      Parameters

      • topic: string

        The topic to publish on.

      • message: unknown

        The payload to deliver to subscribers.

      Returns Promise<void>

    • Subscribes handler to topic.

      Parameters

      • topic: string

        The topic to subscribe to.

      • handler: (message: unknown) => void

        Callback invoked with each message published to the topic.

      Returns Unsubscribe

      An Unsubscribe function that removes this subscription when called.