close method

void close({
  1. String? reason,
})

closing the room for the current user, room will keep on running for the remote users @deprecated - Use leaveRoom from huddleClient instead

Implementation

void close({String? reason}) {
  try {
    logger.i('🔴 Leaving the room');

    _roomId = null;

    remotePeers.clear();

    _lobbyPeers.clear();

    metadata = '{}';

    state = RoomStates.left;

    emit('room-closed', {'reason': reason ?? 'LEFT'});
  } catch (error) {
    logger.e('Error: Leaving the Room => $error');
  }
}