Skip to main content

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

ParameterTypeRequiredDescription
disablePushbooleanNoWhether to stop receiving push notifications for the current user session after disconnecting.

Return value

ValueTypeDescription
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 disconnect when the user logs out of your app.
  • Do not call disconnect for temporary network issues — the SDK handles reconnection automatically.
  • If you need to switch users, call disconnect first, then call connect with the new user's access token.