closePersistenceConnection method

Future<void> closePersistenceConnection({
  1. bool flush = false,
})

Disconnects the chatPersistenceClient from the current user.

Implementation

Future<void> closePersistenceConnection({bool flush = false}) async {
  final client = chatPersistenceClient;
  // If the persistence client is never connected, we don't need to close it.
  if (client == null || !client.isConnected) {
    logger.info('Chat persistence client is not connected');
    return;
  }

  // Disconnect the persistence client.
  return client.disconnect(flush: flush);
}