# onFailure method

1. @override

Future <void> onFailure()
override

Called by the XmppConnection when the reconnection failed.

## Implementation

    @override
    Future<void> onFailure() async {
      final seconds =
          Random().nextInt(_maxBackoffTime - _minBackoffTime) + _minBackoffTime;
      _log.finest('Failure occured. Starting random backoff with ${seconds}s');

      await _timerLock.synchronized(() {
        _timer?.cancel();
        _timer = Timer(Duration(seconds: seconds), onTimerElapsed);
      });
    }