refreshGlobalConnection method

void refreshGlobalConnection()

Refreshes global connection

Implementation

void refreshGlobalConnection() {
  final userId = ChatConfig.instance.userId;
  if (userId == null) return;

  if (_socket != null && _socket!.connected) {
    _log('Refreshing global connection');
    _socket!.emit(_socketEvents.registerUserEvent, {'userId': userId});
    loadChatRooms();
  } else if (_socket == null || !_socket!.connected) {
    _log('Socket not connected, initializing global connection');
    initGlobalConnection();
  }
}