Stone.js API
    Preparing search index...

    The agnostic broadcaster contract: publish an event to a channel.

    The single API the domain touches to emit, on the backend and the frontend alike. On the server it fans out to subscribers; on the client it sends the event up to the server. The concrete effect is resolved by the driver/transport (context).

    interface Broadcaster {
        broadcast: <T = unknown>(
            channel: string,
            event: string,
            payload?: T,
        ) => Promise<void>;
        members: (channel: string) => Promise<PresenceMember<unknown>[]>;
        name: string;
        on: <T = unknown>(
            channel: string,
            listener: RealtimeListener<T>,
        ) => () => void;
        to: (
            channel: string,
        ) => { emit: <T = unknown>(event: string, payload?: T) => Promise<void> };
    }

    Implemented by

    Index
    broadcast: <T = unknown>(
        channel: string,
        event: string,
        payload?: T,
    ) => Promise<void>

    Publish event with payload on channel.

    members: (channel: string) => Promise<PresenceMember<unknown>[]>

    The presence members currently on a channel.

    name: string

    A human-readable name (e.g. 'memory', 'redis').

    on: <T = unknown>(channel: string, listener: RealtimeListener<T>) => () => void

    Subscribe a local listener to a channel; returns an unsubscribe function.

    to: (
        channel: string,
    ) => { emit: <T = unknown>(event: string, payload?: T) => Promise<void> }

    Fluent form: to(channel).emit(event, payload).