run method

  1. @override
void run()
override

Implementation

@override
void run() {
  if(_isFirst) {
    _isFirst = false;
    return;
  }
  final ws = getIt.get<AbstractIOWsChannel>();
  final lastPongFromServer = ws.lastPongFromServer;
  if((lastPongFromServer == null && _lastPongFromServerBeforeWasNull)
      || (lastPongFromServer != null && (lastPongFromServer + intervalInMs) < DateTime.now().millisecondsSinceEpoch)) {
    logger('reconnectWhenDidNotReceivePongFromServerTask reconnecting', level: Level.debug);
    getIt.get<ConnectionService>().reconnect();
  }
  _lastPongFromServerBeforeWasNull = lastPongFromServer == null;
}