Skip to main content

Disconnect

After connecting to RC services, developers can use the following method to disconnect when user switching or logout is required. This method also allows specifying whether to receive push notifications after the user disconnects.

tip

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

Method

Future<int> disconnect(bool receivePush);

Parameter Description

Parameter NameParameter TypeDescription
receivePushboolWhether to receive push notifications after disconnecting. true: receive remote notifications after disconnecting, false: do not receive remote notifications after disconnecting.

Return Value

Return ValueDescription
Future<int>The status code of the current operation. 0 indicates a successful call, and the specific result needs to be implemented via interface callback. Non-zero values indicate that the current interface call operation failed, and no interface callback will be triggered. Refer to the error codes for detailed errors.

Code Example

int? ret = await engine?.disconnect(receivePush);