Skip to main content

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

ValueTypeDescription
voidvoidThe 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:

ParameterTypeRequiredDescription
appKeystringYesYour App Key from the Console
areaCodeAreaCodeNoData center region. Defaults to AreaCode.SG.
logLevelLogLevelNoLog 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

ValueDescription
AreaCode.SGSingapore data center (default)
AreaCode.BJChina (Beijing) data center
AreaCode.NANorth America data center
AreaCode.SARegional data center. Confirm whether AreaCode.SA matches your deployment.
AreaCode.OMOman data center