Skip to main content

Disconnect

After connecting to RC services, developers can disconnect when users need to switch or log out. This method allows you to specify whether to receive push notifications after the user disconnects.

Note The SDK automatically reconnects when switching between foreground and background or when network anomalies occur, ensuring connection reliability. Unless the app logic requires a logout, there's no need to manually disconnect using this method.

Method


disconnect(
receivePush: boolean
): Promise<number>;

Parameter Description

Parameter NameParameter TypeDescription
receivePushbooleanWhether to receive push notifications after disconnecting. true: Receive remote notifications after disconnecting, false: Do not receive remote notifications after disconnecting

Return Value

Return ValueDescription
numberThe status code of the current operation. 0 indicates a successful call, and specific results need to be implemented through interface callbacks. Non-zero values indicate that the current interface call operation failed, and no interface callback will be triggered. For detailed errors, refer to the error codes

Code Example


let code = await engine.disconnect(receivePush);