> ## Documentation Index
> Fetch the complete documentation index at: https://www.text.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Disconnection reasons

Most of the disconnection reasons can be treated as errors. Because of that, you can find their detailed descriptions in this section.

```js theme={null}
customerSDK.on("disconnected", ({ reason }) => {
  switch (reason) {
    case "access_token_expired":
      // handle particular disconnection reasons
      break;
    // ...
    default:
  }
});
```

## Access token expired

Access token lifetime has elapsed. The SDK fetches a new token and reconnects automatically. This is emitted to the user for informational purposes, so for example a reconnection bar can be displayed.

## Connection lost

Disconnected because of the poor connection quality. The SDK will try to reconnect automatically.

## Customer banned

The customer has been banned.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Customer temporarily blocked

The customer tried reconnecting too many times after the [`"too_many_connections"`](#too-many-connections) error had occurred.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Identity mismatch

The identity of the customer has changed between reconnects. This might happen if cookies can't be persisted in the browser.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Inactivity timeout

The customer didn't chat or change the page in the past 30 minutes. The SDK **won't** try to reconnect on its own after receiving this error. You should implement a reconnect login on your own. Preferably you should only try to reconnect when you detect a clear intention of chatting from your user.

## Internal error

Internal error. The SDK reconnects on its own.

## License expired

The license with the specified ID has expired. You should make sure that there are no unpaid invoices for it.

## License not found

The license with the specified ID doesn't exist. You should check the options passed in to the SDK and make sure that the license parameter is correct.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Misdirected connection

You have connected to a server in the wrong region. The SDK reconnects to the correct region on its own, but to avoid this problem altogether, you should provide the correct `region` parameter when initializing the SDK. This is emitted to the user for informational purposes, so for example a reconnection bar can be displayed.

## Too many connections

The customer has reached the maximum number of connections. You should avoid opening too many concurrent connections for the same customer.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Too many unauthorized connections

The maximum number of unauthorized connections has been reached. This error can only be received immediately after you try to connect to our servers when there are too many pending (unauthorized) connections. Once you get authorized, you stay that way and the SDK reconnects on its own.

## Unsupported version

Connecting to an unsupported version of the Customer Chat API. You should upgrade your Customer SDK version.

This internally destroys the current instance of the SDK, so it won't be possible to reuse it.

## Users limit reached

The maximum number of Customers connected at the same time has been reached. This can only be received immediately after we try to connect to our servers, because once you get authorized, you stay that way. The limit is different for each plan, and you can check the exact values on our pricing page.

This internally disconnects from the current instance of the SDK. After that, the manual `connect()` call will be required, preferably linked to the user's action rather than automated.
