Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ServerChooser

This is the interface that defines methods used by the client in order to get a URI/Authenticator required for a connection attempt. A simple ServerChooser implementation is provided: DefaultServerChooser. It keeps a list of AMPS instance URIs and Authenticators, and advances to the next one when a failure occurs.

Hierarchy

  • ServerChooser

Implemented by

Index

Methods

getCurrentAuthenticator

  • This method returns the current authenticator chosen. If no authenticator was chosen yet or is not set, returns null.

    Returns Authenticator | null

    The current authenticator chosen (if any).

getCurrentURI

  • getCurrentURI(): string
  • This method returns the current URI chosen. If no URI was chosen yet, returns null.

    Returns string

    The current URI chosen (if any).

getError

  • getError(): string
  • This method provides additional detail to be included in an exception thrown by when the AMPS instance(s) are not available. Called by the Client when creating an exception.

    Returns string

    A string with information about the connection that failed and the reason for the failure. When no further information is available, returns an empty string.

reportFailure

  • reportFailure(error: Error, connectionInfo: any): void
  • This method is invoked by the Client to indicate a connection failure occurred.

    Parameters

    • error: Error

      An error object containing an error message.

    • connectionInfo: any

      An object of properties associated with the failed connection.

    Returns void

reportSuccess

  • reportSuccess(connectionInfo: any): void
  • This method is invoked by the Client to indicate a connection attempt was successful.

    Parameters

    • connectionInfo: any

      An object of properties associated with the successful connection.

    Returns void