start method Null safety

Future start(
  1. {bool shareHttpServer = false}
)

Starts this instance, allowing it to receive HTTP requests.

Do not invoke this method directly.

Implementation

Future start({bool shareHttpServer = false}) async {
  logger.fine("ApplicationServer($identifier).start entry");

  await channel.prepare();

  entryPoint = channel.entryPoint;
  entryPoint.didAddToChannel();

  logger.fine("ApplicationServer($identifier).start binding HTTP");
  final securityContext = channel.securityContext;
  if (securityContext != null) {
    _requiresHTTPS = true;

    server = await HttpServer.bindSecure(
      options.address,
      options.port,
      securityContext,
      requestClientCertificate: options.isUsingClientCertificate,
      v6Only: options.isIpv6Only,
      shared: shareHttpServer,
    );
  } else {
    _requiresHTTPS = false;

    server = await HttpServer.bind(
      options.address,
      options.port,
      v6Only: options.isIpv6Only,
      shared: shareHttpServer,
    );
  }

  logger.fine("ApplicationServer($identifier).start bound HTTP");
  return didOpen();
}