start method

void start()

Connect to the server if status = STATUS_INIT. Resume UA after being closed.

Implementation

void start() {
  logger.debug('start()');

  if (_status == C.STATUS_INIT) {
    _transport!.connect();
  } else if (_status == C.STATUS_USER_CLOSED) {
    logger.debug('restarting UA');

    // Disconnect.
    if (_closeTimer != null) {
      clearTimeout(_closeTimer);
      _closeTimer = null;
      _transport!.disconnect();
    }

    // Reconnect.
    _status = C.STATUS_INIT;
    _transport!.connect();
  } else if (_status == C.STATUS_READY) {
    logger.debug('UA is in READY status, not restarted');
  } else {
    logger.debug(
        'ERROR: connection is down, Auto-Recovery system is trying to reconnect');
  }

  // Set dynamic configuration.
  _dynConfiguration!.register = _configuration!.register;
}