Initialize the SDK
Before you use any Chat SDK features, call the initialization method. Call it exactly once during the app lifecycle.
Get your app key
The App Key is the unique identifier for your app. You need a valid App Key to initialize the SDK. Find your App Key in the Console.
Messages can only be exchanged between users with the same App Key.
Initialize the SDK
TypeScript
import { NCEngine } from '@nexconn/chat';
NCEngine.initialize({ appKey: '<Your-App-Key>' });
Return value
| Value | Type | Description |
|---|---|---|
void | void | The SDK is initialized synchronously. |
warning
Call NCEngine.initialize only once. Calling it multiple times may cause unexpected behavior.
Configuration options
You can pass additional configuration options during initialization:
| Parameter | Type | Required | Description |
|---|---|---|---|
appKey | string | Yes | Your App Key from the Console |
areaCode | AreaCode | No | Data center region. Defaults to AreaCode.SG. |
logLevel | LogLevel | No | Log verbosity level. Defaults to LogLevel.WARN. |
Example with a specific data center
TypeScript
import { NCEngine, AreaCode, LogLevel } from '@nexconn/chat';
NCEngine.initialize({
appKey: '<Your-App-Key>',
areaCode: AreaCode.NA,
logLevel: LogLevel.WARN,
});
AreaCode values
| Value | Description |
|---|---|
AreaCode.SG | Singapore data center (default) |
AreaCode.BJ | China (Beijing) data center |
AreaCode.NA | North America data center |
AreaCode.SA | Regional data center. Confirm whether AreaCode.SA matches your deployment. |
AreaCode.OM | Oman data center |