Engine configuration
The Chat SDK engine provides the following configuration options. All configurations must be set before initialization.
Data center configuration
By default, the SDK connects to the Singapore data center. If your app uses a different data center, configure the Chat SDK to connect to the correct server address before initialization.
Navigation server
Set the navigation server address for private deployments. naviServer must be a valid server address. No configuration is needed by default — contact your sales representative if required.
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
naviServer: 'your-navigation-server-address',
));
Media server
Set the media server address for private deployments (the upload address for files and images). No configuration is needed by default — contact your sales representative if required.
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
fileServer: 'your-file-server-address',
));
Statistics server
Set the statistics server address. This applies only to standalone data centers. No configuration is needed by default — contact your sales representative if required.
statisticServer must be a valid server address. An invalid address causes push notifications and other services to fail.
Format requirements:
- For HTTPS:
https://cn.xxx.com:portorhttps://cn.xxx.com. The domain can be an IP address. If no port is specified, port 443 is used by default. - For HTTP:
cn.xxx.com:portorcn.xxx.com. The domain can be an IP address. If no port is specified, port 80 is used by default. (iOS uses HTTPS by default. If you use HTTP, configure ATS permissions in your iOS project.)
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
statisticServer: 'your-statistics-server-address',
));
Push configuration
Push is a common feature. The Chat SDK includes built-in push support and integrates with multiple third-party push providers. Push is triggered after SDK initialization, so configure push settings before calling create. See Enable push notifications for details.
Android push configuration
Configure push options during initialization. Enable the push channels your app supports:
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
pushOptions: PushOptions(
enableHWPush: true,
enableFCM: true,
),
));
Kick reconnecting devices
A user-level setting that determines whether to kick the currently reconnecting device on reconnection. Requires the App Key to have user-level configuration enabled. See Reconnection and device conflicts.
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
kickReconnectDevice: true,
));
Compression options
Configure how the SDK compresses images when sending.
| Parameter | Type | Description |
|---|---|---|
| originalImageQuality | int? | Original image compression quality |
| originalImageMaxSize | int? | Maximum file size of the original image after compression (in KB) |
| originalImageSize | int? | Target file size for the original image (in KB). Images smaller than this are sent without compression. |
| thumbnailQuality | int? | Thumbnail compression quality |
| thumbnailMaxSize | int? | Maximum file size of the thumbnail after compression (in KB) |
await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
compressOptions: CompressOptions(
originalImageQuality: 80,
originalImageMaxSize: 1080,
originalImageSize: 200,
thumbnailQuality: 80,
thumbnailMaxSize: 500,
),
));