bind static method

Future<MultiProtocolHttpServer> bind(
  1. Object? address,
  2. int port,
  3. SecurityContext context, {
  4. ServerSettings? settings,
})

Binds a new SecureServerSocket with a security context at port and address (see SecureServerSocket.bind for a description of supported types for address).

Optionally settings can be supplied which will be used for HTTP/2 clients.

See also startServing.

Implementation

static Future<MultiProtocolHttpServer> bind(
    Object? address, int port, SecurityContext context,
    {http2.ServerSettings? settings}) async {
  context.setAlpnProtocols(['h2', 'h2-14', 'http/1.1'], true);
  var secureServer = await SecureServerSocket.bind(address, port, context);
  return MultiProtocolHttpServer._(secureServer, settings);
}