Options
Menu

Class Convergence

This is the entry point for the Convergence JS client. It allows users to connect to the Convergence Engine using a variety of authentication methods. On success, each connection method returns a ConvergenceDomain bound to the Domain at the specified URL.

See the Developer Guide for more information about authentication options.

Hierarchy

  • Convergence

Index

Methods

configureLogging

  • Allows customization of both the root (default) logger and any ancillary loggers.

    Convergence.configureLogging({
      root: LogLevel.ERROR,
      loggers: {
        "connection": LogLevel.DEBUG
      }
    });
    

    The available loggers (and where / how they are used) are:

    • "connection" (Connection and authentication messages)
    • "protocol.messages" (All messages to/from the server)
    • "protocol.ping" (All ping/pong messages to/from the server)
    • "heartbeat" (Heartbeat messages)
    • "activities.activity" (Activity)
    • "activities.service" (ActivityService)
    • "models" (ModelService, RealTimeModel)
    • "storage" (Offline store)

    Parameters

    Returns void

connect

  • Connects to a Convergence Domain using username / password authentication.

    deprecated

    Use connectWithPassword instead.

    Parameters

    • url: string

      The URL of the Convergence Domain to connect to.

    • username: string

      The username of the Convergence Domain User to connect as.

    • password: string

      The password for the corresponding Convergence Domain User.

    • options: IConvergenceOptions

      Options that configure the behavior of the client.

    • cancellationToken: CancellationToken

      Allow the user to bind a callback to cancel the connection.

    Returns Promise<ConvergenceDomain>

    A Promise which will be resolved with the ConvergenceDomain upon successful connection.

connectAnonymously

  • Connects to a Convergence Domain using anonymous authentication. For this to work, the domain must be configured to allow anonymous authentication.

    Parameters

    • url: string

      The URL of the Convergence Domain to connect to.

    • displayName: string | (() => Promise<string>)

      The display name to use for the anonymous user.

    • options: IConvergenceOptions

      Options that configure the behavior of the client.

    • cancellationToken: CancellationToken

      Allow the user to bind a callback to cancel the connection.

    Returns Promise<ConvergenceDomain>

    A Promise which will be resolved with the ConvergenceDomain upon successful connection.

connectWithJwt

  • Connects to a Convergence Domain using a JSON Web Token (JWT) for authentication. See the developer guide for information about configuring the server to accept JWTs.

    Parameters

    • url: string

      The URL of the Convergence Domain to connect to.

    • jwt: string | (() => Promise<string>)

      A valid JSON Web Token (JWT) indicating the Domain User to connect as.

    • options: IConvergenceOptions

      Options that configure the behavior of the client.

    • cancellationToken: CancellationToken

      Allow the user to bind a callback to cancel the connection.

    Returns Promise<ConvergenceDomain>

    A Promise which will be resolved with the ConvergenceDomain upon successful connection.

connectWithPassword

  • Connects to a Convergence Domain using username / password authentication.

    Parameters

    • url: string

      The URL of the Convergence Domain to connect to.

    • credentials: IUsernameAndPassword | (() => Promise<IUsernameAndPassword>)

      The username and password of the Convergence Domain User to connect as.

    • options: IConvergenceOptions

      Options that configure the behavior of the client.

    • cancellationToken: CancellationToken

      Allow the user to bind a callback to cancel the connection.

    Returns Promise<ConvergenceDomain>

    A Promise which will be resolved with the ConvergenceDomain upon successful connection.

reconnect

  • Reconnects to the specified domain using a previously generated reconnect token (which can be obtained from an existing ConvergenceSession).

    Parameters

    • url: string

      The URL of the Convergence Domain to connect to

    • token: string

      The reconnect token to use for authentication

    • options: IConvergenceOptions

      Options that configure the behavior of the client.

    • cancellationToken: CancellationToken

      Allow the user to bind a callback to cancel the connection.

    Returns Promise<ConvergenceDomain>

    A Promise which will be resolved with the ConvergenceDomain upon successful connection.