pause method

void pause()

Pause subscription.

Pausing subscription will prevent the messages and presence streams from emitting messages. Keep in mind that you may miss messages while subscription is paused. If subscription is currently paused, this method is a no-op.

Implementation

void pause() {
  if (isCancelled) {
    _logger
        .warning('Tried to pause a subscription that is already cancelled.');
    return;
  }

  if (isPaused) {
    _logger
        .silly('Pausing a subscription that is already paused is a no-op.');
    return;
  }

  _logger.info('Pausing subscription.');

  _envelopeSubscription?.cancel();
  _envelopeSubscription = null;
}