logout method

  1. @override
Future<void> logout()
override

Disconnects and clears all local state (rooms, messages, contacts).

Call on user-initiated sign-out. Unlike disconnect, this also wipes the local cache so the next sign-in starts cold. Do NOT use for background/foreground transitions — that's disconnect. The client remains usable after logout; you can re-authenticate and call connect again on the same instance.

Implementation

@override
Future<void> logout() async {
  await disconnect();
  _rooms.clear();
  _messages.clear();
  _contacts.clear();
  _users.clear();
  _unread.clear();
  _pinned.clear();
  _muted.clear();
}