@dxos/react-client
    Preparing search index...

    Class DedicatedWorkerClientServices

    Runs services in a dedicated worker, exposed to other tabs. Leader election is used to ensure only a single worker is running.

    Hierarchy

    • Resource
      • DedicatedWorkerClientServices

    Implements

    Index

    Constructors

    Properties

    onReconnect: (callback: () => Promise<void>) => void

    Register a callback to be invoked when services reconnect. The callback should re-establish any RPC streams. Reconnection waits for all callbacks to complete before emitting reconnected.

    Accessors

    • get _ctx(): Context

      Returns Context

    • get _lifecycleState(): LifecycleState

      Returns LifecycleState

    • get closed(): Event<undefined | Error>

      The connection to the services provider was terminated. This should fire if the services disconnect unexpectedly or during a client reset.

      Returns Event<undefined | Error>

    • get isOpen(): boolean

      Returns boolean

    • get reconnected(): Event<void>

      The underlying service connection was re-established. Fires after all reconnection callbacks have completed.

      Returns Event<void>

    • get rpc(): ClientServicesRpc

      Effect-native client for all client services, inferred from the effect-rpc definitions. Preferred surface for new consumers; must be re-read after reconnect rather than cached. Effects it produces require only the default runtime and can be run with any Runtime<never>.

      Returns ClientServicesRpc

    Methods

    • Error handler for errors that are caught by the context. By default, errors are bubbled up to the parent context which is passed to the open method.

      Parameters

      • err: Error

      Returns Promise<void>

    • To be overridden by subclasses.

      Returns Promise<void>

    • To be overridden by subclasses.

      Returns Promise<void>

    • Opens the resource. If the resource is already open, it does nothing. If the resource is in an error state, it throws an error. If the resource is closed, it waits for it to close and then opens it.

      Parameters

      • Optionalctx: Context

        Context to use for opening the resource. This context will receive errors that are not handled in _catch.

      Returns Promise<DedicatedWorkerClientServices>

    • Waits until the resource is open.

      Returns Promise<void>