Class RpcBaseClient

Hierarchy

Implements

Constructors

Properties

actionClient: RpcActionClient = ...
events: Subject<RpcClientEvent> = ...
messageId: number = 1
replies: Map<number, ((message: RpcMessage) => void)> = ...
token: RpcClientToken = ...
typeReuseDisabled: boolean = false
username?: string

Methods

  • Per default entity types with a name (@entity.name()) will be reused. If a entity with a given name was not loaded and error is thrown. This to ensure nominal typing (object instanceof T). Use this method to disable this behavior and construct new nominal types if an entity is not loaded.

    Returns RpcBaseClient

  • The connection process is only finished when this method resolves and doesn't throw. When an error is thrown, the authentication was unsuccessful.

    If you use controllers in this callback, make sure to use dontWaitForConnection=true, otherwise you get an endless loop.

    async onAuthenticate(): Promise<void> {
    const auth = this.controller<AuthController>('auth', {dontWaitForConnection: true});
    const result = auth.login('username', 'password');
    if (!result) throw new AuthenticationError('Authentication failed);
    }

    Returns Promise<void>

  • Type Parameters

    • T

    Parameters

    • type: number
    • Optional body: T
    • Optional schema: ReceiveType<T>
    • options: {
          connectionId?: number;
          dontWaitForConnection?: boolean;
          peerId?: string;
          timeout?: number;
      } = {}
      • Optional connectionId?: number
      • Optional dontWaitForConnection?: boolean
      • Optional peerId?: string
      • Optional timeout?: number

    Returns RpcMessageSubject

Generated using TypeDoc