kkrpc
    Preparing search index...

    Interface RPCChannelOptions<LocalAPI>

    Options used to configure an RPCChannel.

    interface RPCChannelOptions<LocalAPI extends object = object> {
        enableTransfer?: boolean;
        expose?: LocalAPI;
        getMetadata?: () => undefined | RPCMessageMetadata;
        onClose?: (reason?: Error) => void;
        onUncaughtError?: (
            error: Error,
            context: { kind: "set" | "callback"; path?: string[] },
        ) => void;
        plugins?: RPCPlugin[];
        timeout?: number;
    }

    Type Parameters

    • LocalAPI extends object = object
    Index

    Properties

    enableTransfer?: boolean

    Disable transferable forwarding even when the transport supports it.

    expose?: LocalAPI

    Local API object to expose to the remote side.

    getMetadata?: () => undefined | RPCMessageMetadata

    Optional provider for protocol-level metadata on outgoing request messages.

    onClose?: (reason?: Error) => void

    Called once when the underlying transport reports the connection closed (remote close or network error), after pending requests have been rejected. reason is an Error for abnormal termination, undefined for a clean close. Requires a transport that implements onClose; otherwise never fires. The channel is not destroyed — reconnect by creating a new transport and channel.

    onUncaughtError?: (
        error: Error,
        context: { kind: "set" | "callback"; path?: string[] },
    ) => void

    Observe errors from fire-and-forget paths that would otherwise be swallowed: a failed set on a remote proxy (kind: "set") and a thrown/rejected local callback invocation (kind: "callback"). Purely for diagnostics; without it these paths stay silent as before.

    plugins?: RPCPlugin[]

    Plugins that run while handling incoming requests.

    timeout?: number

    Request timeout in milliseconds. Set to 0 to disable timeouts.