The WebsocketClient has direct access to the server. It is used to simulate the client. This is usually executed on the client.

Hierarchy

Constructors

Properties

_token: string = ""
callback: ((method, data, messageId) => any)

Type declaration

    • (method, data, messageId): any
    • Parameters

      • method: string
      • data: any
      • messageId: number

      Returns any

expectedMethods: Map<string | number, Function> = ...
expectedMethodsRejectionCallback: Map<number, Function> = ...
isConnected: boolean = true

states wether the client is connected

Returns

true as the client is always connected during test runs

messageId: number = 0
outbounds: Map<string, ((data, specificHash, inserted, updated, deleted, length, _client) => void)> = ...

Type declaration

    • (data, specificHash, inserted, updated, deleted, length, _client): void
    • Parameters

      • data: any
      • specificHash: number
      • inserted: any[]
      • updated: any[]
      • deleted: any[]
      • length: number
      • _client: WebsocketClient

      Returns void

pool: {
    WssConnected: boolean;
}

Reference to the current pool. A pool can be used to store and access data using Outbounds.

Type declaration

  • WssConnected: boolean
handles: Map<string, DecorableFunction> = ...

Deprecated

onSuccessHandlers: {
    callback: DecorableFunction;
    regexp: RegExp;
}[] = []

Type declaration

Deprecated

Accessors

Methods

  • Initializes the socket callback.

    Parameters

    • callback: ((method, data, messageId) => any)

      This callback will be called, once any message is sent from the ws api

        • (method, data, messageId): any
        • Parameters

          • method: string
          • data: any
          • messageId: number

          Returns any

    Returns void

  • This allows to listen for outbound data to be received.

    Parameters

    • method: string

      method label of the outbound

    • callback: ((data, specificHash, inserted, updated, deleted, length, _client) => void)

      this is called once the data has been received

        • (data, specificHash, inserted, updated, deleted, length, _client): void
        • Parameters

          • data: any
          • specificHash: number
          • inserted: any[]
          • updated: any[]
          • deleted: any[]
          • length: number
          • _client: WebsocketClient

          Returns void

    Returns void

  • This method is called whenever a request transaction (route) has been sent to the server and a response has been received

    SuccessHandlers can be used to show notifications on the client device.

    Parameters

    • method: string

      method of the successfully executed method

    Returns void

  • This handles all received messages. Depending on expected message config and other route configuration, different methods are called.

    Parameters

    • param0: {
          data: any;
          deleted: any[];
          inserted: any[];
          length: number;
          messageId: number;
          method: string;
          specificHash: number;
          updated: any[];
      }

      message data

      • data: any
      • deleted: any[]
      • inserted: any[]
      • length: number
      • messageId: number
      • method: string
      • specificHash: number
      • updated: any[]

    Returns void

  • This handles received data. This is the first point of the transaction, that usually takes place on the clients device.

    Parameters

    • method: string

      Method of the message

    • data: any

      Transmitted data

    Returns number

    the messageId (can be used to refer message responses)

Generated using TypeDoc