RSX Code Reference
    Preparing search index...
    • rsx
    • RpcMulticastPromise

    Type Alias RpcMulticastPromise<T>

    RpcMulticastPromise: Promise<T>

    Return type for multicast RPC methods.

    When implementing a multicast RPC, simply return the value of type T:

    public async broadcast(msg: string): RpcMulticastPromise<boolean> {
    return true; // Just return the raw value
    }

    When calling a multicast RPC, use rpcUnwrap to get proper typing:

    const results = rpcUnwrap(await this.broadcast("Hello"));
    for (const r of results) {
    console.log(`Client ${r.connectionId}: ${r.returnValue}`);
    }

    Type Parameters

    • T

      The value type returned by each client's implementation