Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Hierarchy

  • Client

Index

Constructors

constructor

  • new Client(name?: string): Client
  • Parameters

    • Optional name: string

    Returns Client

Methods

ack

  • ack(message: Message, options?: string): void
  • ack(topic: string, bookmark: string, options?: string): void
  • Parameters

    • message: Message
    • Optional options: string

    Returns void

  • Parameters

    • topic: string
    • bookmark: string
    • Optional options: string

    Returns void

ackBatchSize

  • ackBatchSize(): number
  • ackBatchSize(ackBatchSize: number): Client
  • Returns number

    The client if a setter is called. The acknowledgement batch size otherwise.

  • Parameters

    • ackBatchSize: number

    Returns Client

ackTimeout

  • ackTimeout(): number
  • ackTimeout(ackTimeout: number): Client
  • Returns number

    The client if a setter is called. The acknowledgement batch timeout value (if any) otherwise.

  • Parameters

    • ackTimeout: number

    Returns Client

addConnectionStateListener

  • addConnectionStateListener(connectionStateListener: function): number
  • Parameters

    • connectionStateListener: function
        • (connectionState: number): void
        • Parameters

          • connectionState: number

          Returns void

    Returns number

    The unique monotonically increasing listener id that can be used to remove the listener later.

autoAck

  • autoAck(): boolean
  • autoAck(autoAck: boolean): Client
  • Returns boolean

    The client if a setter is called. The autoAck otion value otherwise.

  • Parameters

    • autoAck: boolean

    Returns Client

bookmarkStore

connect

  • Parameters

    • Optional uri: string
    • Optional authenticator: Authenticator
    • Optional logonOptions: string

    Returns Promise<Message>

    The promise object with the result of fullfilling/failing the connection promise.

delayStrategy

deltaPublish

  • deltaPublish(topic: string, data: any, params?: CommandParams): void
  • Parameters

    Returns void

deltaSubscribe

  • deltaSubscribe(onMessage: function, topic: string, filter?: string, params?: CommandParams): Promise<string>
  • Parameters

    • onMessage: function
    • topic: string
    • Optional filter: string
    • Optional params: CommandParams

    Returns Promise<string>

    The Promise object with the results of execution of the command.

disconnect

  • disconnect(): Promise<any>
  • Returns Promise<any>

    The promise object.

disconnectHandler

  • disconnectHandler(): function
  • disconnectHandler(disconnectHandler: function): Client
  • Returns function

    The client if a setter called, the disconnect handler (if any) otherwise.

      • (client: Client, error: Error): void
      • Parameters

        Returns void

  • Parameters

    • disconnectHandler: function
        • (client: Client, error: Error): void
        • Parameters

          Returns void

    Returns Client

errorHandler

  • errorHandler(): function
  • errorHandler(errorHandler: function): Client
  • Returns function

    The client if a setter called, the error handler (if any) otherwise.

      • (error: Error): void
      • Parameters

        • error: Error

        Returns void

  • Parameters

    • errorHandler: function
        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    Returns Client

execute

  • execute(command: Command, handler?: function, timeout?: number): Promise<string>
  • Parameters

    • command: Command
    • Optional handler: function
    • Optional timeout: number

    Returns Promise<string>

    The promise object fullfilled with the command id created.

failedWriteHandler

  • failedWriteHandler(): function
  • failedWriteHandler(failedWriteHandler: function): Client
  • Returns function

    The client if a setter called, the failed write handler (if any) otherwise.

      • (message: Message, reason: string): void
      • Parameters

        Returns void

  • Parameters

    • failedWriteHandler: function
        • (message: Message, reason: string): void
        • Parameters

          Returns void

    Returns Client

flush

  • flush(timeout?: number): Promise<__type>
  • Parameters

    • Optional timeout: number

    Returns Promise<__type>

    The Promise object with the results of execution of the command.

heartbeat

  • heartbeat(interval: number, timeout?: number): Client
  • Parameters

    • interval: number
    • Optional timeout: number

    Returns Client

    The Client object.

lastChanceMessageHandler

  • lastChanceMessageHandler(): function
  • lastChanceMessageHandler(lastChanceMessageHandler: function): Client
  • Returns function

    The client if a setter called, the last chance message handler (if any) otherwise.

  • Parameters

    • lastChanceMessageHandler: function

    Returns Client

logonCorrelationId

  • logonCorrelationId(): string
  • logonCorrelationId(logonCorrelationId: string): Client
  • Returns string

    The client if a setter is called. The logon correlation id (if any) otherwise.

  • Parameters

    • logonCorrelationId: string

    Returns Client

logonOptions

  • logonOptions(): string
  • logonOptions(logonOptions: string): Client
  • Returns string

    The client if a setter is called. The logon options (if any) otherwise.

  • Parameters

    • logonOptions: string

    Returns Client

name

  • name(name?: string): Client | string
  • Parameters

    • Optional name: string

    Returns Client | string

    The client object if the setter is called. The name of the AMPS client instance (if any) otherwise.

publish

  • publish(topic: string, data: any, params?: CommandParams): void
  • Parameters

    Returns void

publishStore

  • Returns PublishStore

    The client if a setter is called. The PublishStore object (if any) otherwise.

  • Parameters

    Returns Client

reconnectDelay

  • reconnectDelay(delay?: number): Client
  • Parameters

    • Default value delay: number = 200

    Returns Client

    The client object.

removeConnectionStateListener

  • removeConnectionStateListener(connectionStateListenerId: number): void
  • Parameters

    • connectionStateListenerId: number

    Returns void

serverChooser

serverVersion

  • serverVersion(): string
  • Returns string

    The version of the AMPS server.

serverVersionAsInt

  • serverVersionAsInt(): number
  • Returns number

    The version of the AMPS server.

sow

  • sow(onMessage: function, topic: string, filter?: string, params?: CommandParams): Promise<string>
  • Parameters

    • onMessage: function
    • topic: string
    • Optional filter: string
    • Optional params: CommandParams

    Returns Promise<string>

    The Promise object with the results of execution of the command.

sowAndDeltaSubscribe

  • sowAndDeltaSubscribe(onMessage: function, topic: string, filter?: string, params?: CommandParams): Promise<string>
  • Parameters

    • onMessage: function
    • topic: string
    • Optional filter: string
    • Optional params: CommandParams

    Returns Promise<string>

    The Promise object with the results of execution of the command.

sowAndSubscribe

  • sowAndSubscribe(onMessage: function, topic: string, filter?: string, params?: CommandParams): Promise<string>
  • Parameters

    • onMessage: function
    • topic: string
    • Optional filter: string
    • Optional params: CommandParams

    Returns Promise<string>

    The Promise object with the results of execution of the command.

sowDelete

  • sowDelete(topic: string, filter: string, options?: string): Promise<Message>
  • Parameters

    • topic: string
    • filter: string
    • Optional options: string

    Returns Promise<Message>

    The promise object with the results of execution of the command.

sowDeleteByData

  • sowDeleteByData(topic: string, data: any): Promise<Message>
  • Parameters

    • topic: string
    • data: any

    Returns Promise<Message>

    The promise object with the results of execution of the command.

sowDeleteByKeys

  • sowDeleteByKeys(topic: string, keys: string): Promise<Message>
  • Parameters

    • topic: string
    • keys: string

    Returns Promise<Message>

    The promise object with the results of execution of the command.

subscribe

  • subscribe(onMessage: function, topic: string, filter?: string, params?: CommandParams): Promise<string>
  • Parameters

    • onMessage: function
    • topic: string
    • Optional filter: string
    • Optional params: CommandParams

    Returns Promise<string>

    The Promise object with the results of execution of the command.

subscriptionManager

transportFilter

  • transportFilter(): function
  • transportFilter(transportFilter: function): Client
  • Returns function

    The client if a setter called, the transport filter method (if any) otherwise.

      • (data: any, outgoing?: boolean): void
      • Parameters

        • data: any
        • Optional outgoing: boolean

        Returns void

  • Parameters

    • transportFilter: function
        • (data: any, outgoing?: boolean): void
        • Parameters

          • data: any
          • Optional outgoing: boolean

          Returns void

    Returns Client

unsubscribe

  • unsubscribe(subId?: string): Promise<string>
  • Parameters

    • Optional subId: string

    Returns Promise<string>

    The Promise object with the results of execution of the command.

Static createMemoryBacked

  • createMemoryBacked(name?: string): Client
  • Parameters

    • Optional name: string

    Returns Client

    a highly available Client instance.

Static version

  • version(): string
  • Returns string

    The version of this AMPS client.

Object literals

Static Bookmarks

Bookmarks: object

EPOCH

EPOCH: string = "0"

MOST_RECENT

MOST_RECENT: string = "recent"

NOW

NOW: string = "0|1|"

Static ConnectionStateListener

ConnectionStateListener: object

Connected

Connected: number = 2

Disconnected

Disconnected: number = 0

HeartbeatInitiated

HeartbeatInitiated: number = 16

LoggedOn

LoggedOn: number = 4

PublishReplayed

PublishReplayed: number = 8

Resubscribed

Resubscribed: number = 32

Shutdown

Shutdown: number = 1

UNKNOWN

UNKNOWN: number = 16834