disconnect static method
will disable the Web-socket connections manually
While calling the init() function on the app startup, need to inform the SDK that you will be managing the web socket connect from autoEstablishSocketConnection.
Once the connection is disables , you will stop receiving all the real-time events for the logged in user
Implementation
static Future<Null> disconnect(
{Function(String successMessage)? onSuccess,
Function(CometChatException e)? onError}) async {
try {
if (onSuccess != null && onError != null) {
final result = await channel.invokeMethod('disconnectNew', null);
onSuccess(result);
} else {
await channel.invokeMethod('disconnect', {});
}
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
}