resetForSessionChange method

void resetForSessionChange()

Implementation

void resetForSessionChange() {
  stop();
  final removed = _intentRegistry.clear();
  for (final _ in removed) {
    _record(SubscriptionIntentTelemetryEvent(
      kind: TelemetryEventKind.subscriptionIntentRemoved,
      at: _clock.now(),
    ));
  }
  _dedup.clear();
  _pendingSubscriptions.clear();
  _sentSubscribeChannelsThisGeneration.clear();
  _wasUncertainDisconnect = false;
  _wasBackgrounded = false;
  if (_activeRoomChannel != null ||
      _activeRoomChannelName != null ||
      _presenceMembers.isNotEmpty) {
    _activeRoomChannel = null;
    _activeRoomChannelName = null;
    _activeRoomAuth = null;
    _presenceMembers.clear();
    _emitPresenceEvent(const PresenceSnapshot({}));
    _notifyActiveRoomChanged(null);
  }
  _record(SessionResetTelemetryEvent(at: _clock.now()));
}