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
- connect
- connectAnonymously
- connectWithJwt
- connectWithPassword
- reconnect

## Methods

### StaticconfigureLogging

- configureLogging(config: ILoggingConfigData): void

- 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

  - ##### config: ILoggingConfigData

    the log levels for the root logger and any other loggers.

  #### Returns void

### Staticconnect

- connect(url: string, username: string, password: string, options?: IConvergenceOptions, cancellationToken?: CancellationToken): Promise<ConvergenceDomain>

- 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.

  - ##### Optional options: IConvergenceOptions

    Options that configure the behavior of the client.

  - ##### Optional 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.

### StaticconnectAnonymously

- connectAnonymously(url: string, displayName?: string | function, options?: IConvergenceOptions, cancellationToken?: CancellationToken): Promise<ConvergenceDomain>

- 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.

  - ##### Optional displayName: string | function

    The display name to use for the anonymous user.

  - ##### Optional options: IConvergenceOptions

    Options that configure the behavior of the client.

  - ##### Optional 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.

### StaticconnectWithJwt

- connectWithJwt(url: string, jwt: string | function, options?: IConvergenceOptions, cancellationToken?: CancellationToken): Promise<ConvergenceDomain>

- 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 | function

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

  - ##### Optional options: IConvergenceOptions

    Options that configure the behavior of the client.

  - ##### Optional 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.

### StaticconnectWithPassword

- connectWithPassword(url: string, credentials: IUsernameAndPassword | function, options?: IConvergenceOptions, cancellationToken?: CancellationToken): Promise<ConvergenceDomain>

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

  #### Parameters

  - ##### url: string

    The URL of the Convergence Domain to connect to.

  - ##### credentials: IUsernameAndPassword | function

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

  - ##### Optional options: IConvergenceOptions

    Options that configure the behavior of the client.

  - ##### Optional 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.

### Staticreconnect

- reconnect(url: string, token: string, options?: IConvergenceOptions, cancellationToken?: CancellationToken): Promise<ConvergenceDomain>

- 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

  - ##### Optional options: IConvergenceOptions

    Options that configure the behavior of the client.

  - ##### Optional 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.