Class Registry<L, R>

Exposes local RPCs and implements remote RPCs

Type Parameters

  • L extends Object

  • R extends Object

Hierarchy

  • Registry

Constructors

  • Create a new registry

    Type Parameters

    • L extends Object

    • R extends Object

    Parameters

    • local: L

      Class with local RPCs to expose

    • remote: R

      Class with remote RPC placeholders to implement

    • Optional hooks: IRegistryHooks

      Global hooks

    Returns Registry<L, R>

Methods

  • Iterate over list of connected remotes

    Parameters

    • cb: ((remoteID: string, remote: R) => Promise<void>)

      Function to execute for each remote

        • (remoteID: string, remote: R): Promise<void>
        • Parameters

          • remoteID: string
          • remote: R

          Returns Promise<void>

    Returns Promise<void>

  • Expose local RPCs and implement remote RPCs via a message-based transport

    Type Parameters

    • T

    Parameters

    • signal: undefined | AbortSignal

      AbortSignal for in-flight RPC operations

    • requestWriter: WritableStreamDefaultWriter<T>

      Stream to write requests to

    • responseWriter: WritableStreamDefaultWriter<T>

      Stream to write responses to

    • requestReader: ReadableStreamDefaultReader<T>

      Stream to read requests from

    • responseReader: ReadableStreamDefaultReader<T>

      Stream to read responses from

    • marshal: ((value: any) => T)

      Function to marshal nested values with

        • (value: any): T
        • Parameters

          • value: any

          Returns T

    • unmarshal: ((text: T) => any)

      Function to unmarshal nested values with

        • (text: T): any
        • Parameters

          • text: T

          Returns any

    • Optional hooks: ILinkHooks

      Link hooks

    Returns void

  • Expose local RPCs and implement remote RPCs via a stream-based transport

    Type Parameters

    • T

    Parameters

    • signal: undefined | AbortSignal

      AbortSignal for in-flight RPC operations

    • encoder: WritableStream<any>

      Stream to write messages to

    • decoder: ReadableStream<any>

      Stream to read messages from

    • marshal: ((value: any) => T)

      Function to marshal nested values with

        • (value: any): T
        • Parameters

          • value: any

          Returns T

    • unmarshal: ((text: T) => any)

      Function to unmarshal nested values with

        • (text: T): any
        • Parameters

          • text: T

          Returns any

    • Optional hooks: ILinkHooks

      Link hooks

    Returns void

Generated using TypeDoc