Class RpcClient

Constructors

Accessors

Methods

  • Make an RPC call and wait for the response

    Type Parameters

    Parameters

    • method: string
    • Optional params: TParams
    • Optional options: {
          timeout?: number;
          signal?: AbortSignal;
      }
      • Optional timeout?: number
      • Optional signal?: AbortSignal

    Returns Promise<TResult>

  • Register a handler for server-initiated notifications

    Parameters

    • method: string
    • handler: ((params?) => void)
        • (params?): void
        • Parameters

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Make a batch of RPC calls

    Type Parameters

    Parameters

    • calls: T

    Returns Promise<BatchResults<T>>

  • Create a typed proxy for natural method calls

    Type Parameters

    • T extends object

    Returns TypedProxy<T>

    Example

    const api = client.proxy<MyApi>();
    const result = await api.math.add(1, 2);