Disconnect
Disconnect the current user from the Nexconn chat server.
Disconnect from the server
Call NCEngine.disconnect(disablePush?) to close the connection. After disconnecting, the user cannot send or receive messages, fetch remote messages, or retrieve channel lists.
TypeScript
await NCEngine.disconnect();
console.log('Disconnected');
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
disablePush | boolean | No | Whether to stop receiving push notifications for the current user session after disconnecting. |
Return value
| Value | Type | Description |
|---|---|---|
Promise<void> | Promise<void> | Resolves when the SDK finishes disconnecting the current session. |
warning
- After calling
disconnect, the SDK stops the automatic reconnection mechanism. - Offline messages are stored for 7 days by default.
When to disconnect
- Call
disconnectwhen the user logs out of your app. - Do not call
disconnectfor temporary network issues — the SDK handles reconnection automatically. - If you need to switch users, call
disconnectfirst, then callconnectwith the new user's access token.