startSecure method

Future startSecure (
  1. {WebSocketHandler handleWs: null,
  2. SecurityContext context,
  3. bool requestClientCertificate: false,
  4. int backlog: 0}

This method helps to start your webserver in a secure way.

You can add a WebSocketHandler, SecurityContext, requestClientCertificate, backlog

The optional argument backlog can be used to specify the listen backlog for the underlying OS listen setup. If backlog has the value of 0 (the default) a reasonable value will be chosen by the system.

The certificate chain and the private key are set in the context SecurityContext object that is passed to bindSecure.


Future startSecure({WebSocketHandler handleWs: null, SecurityContext context, bool requestClientCertificate: false,
  int backlog: 0}) {
    HttpServer.bindSecure(bind_address, port, context,
        requestClientCertificate: requestClientCertificate,
        backlog: backlog).then((server) {
      _onStartComplete(server, handleWs);
    }).catchError((e) {
      var error = _errorOnStart(e);
      return new Future.error(error);

    return _completer.future;