http_multi_server 2.0.4

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 94

An implementation of dart:io's HttpServer that wraps multiple servers and forwards methods to all of them. It's useful for serving the same application on multiple network interfaces while still having a unified way of controlling the servers. In particular, it supports serving on both the IPv4 and IPv6 loopback addresses using HttpMultiServer.loopback.

import 'package:http_multi_server/http_multi_server.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() {
  // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same
  // server.
  HttpMultiServer.loopback(8080).then((server) {
    shelf_io.serveRequests(server, (request) {
      return new shelf.Response.ok("Hello, world!");
    });
  });
}

2.0.4

  • Declare support for async 2.0.0.

2.0.3

  • Fix HttpMultiServer.loopback() and .loopbackSecure() for environments that don't support IPv4.

2.0.2

  • Fix a dependency that was incorrectly marked as dev-only.

2.0.1

  • Fix most strong mode errors and warnings.

2.0.0

  • Breaking: Change the signature of HttpMultiServer.loopbackSecure() to match the new Dart 1.13 HttpServer.bindSecure() signature. This removes the certificateName named parameter and adds the required context parameter and the named v6Only and shared parameters.

  • Added v6Only and shared parameters to HttpMultiServer.loopback() to match HttpServer.bind().

1.3.2

  • Eventually stop retrying port allocation if it fails repeatedly.

  • Properly detect socket errors caused by already-in-use addresses.

1.3.1

  • loopback() and loopbackSecure() recover gracefully if an ephemeral port is requested and the located port isn't available on both IPv4 and IPv6.

1.3.0

  • Add support for HttpServer.autoCompress.

1.2.0

  • Add support for HttpServer.defaultResponseHeaders.clear.

  • Fix HttpServer.defaultResponseHeaders.remove and .removeAll.

1.1.0

  • Add support for HttpServer.defaultResponseHeaders.

1.0.2

1.0.1

  • Ignore errors from one of the servers if others are still bound. In particular, this works around issue 19815 on some Windows machines where IPv6 failure isn't discovered until we try to connect to the socket.

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  http_multi_server: "^2.0.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:http_multi_server/http_multi_server.dart';
        
Version Uploaded Documentation Archive
2.0.4 Sep 22, 2017 Go to the documentation of http_multi_server 2.0.4 Download http_multi_server 2.0.4 archive
2.0.3 Oct 25, 2016 Go to the documentation of http_multi_server 2.0.3 Download http_multi_server 2.0.3 archive
2.0.2 Jun 20, 2016 Go to the documentation of http_multi_server 2.0.2 Download http_multi_server 2.0.2 archive
2.0.1 Apr 1, 2016 Go to the documentation of http_multi_server 2.0.1 Download http_multi_server 2.0.1 archive
2.0.0 Dec 9, 2015 Go to the documentation of http_multi_server 2.0.0 Download http_multi_server 2.0.0 archive
1.3.2 Mar 10, 2015 Go to the documentation of http_multi_server 1.3.2 Download http_multi_server 1.3.2 archive
1.3.1 Mar 9, 2015 Go to the documentation of http_multi_server 1.3.1 Download http_multi_server 1.3.1 archive
1.3.0+1 Sep 24, 2014 Go to the documentation of http_multi_server 1.3.0+1 Download http_multi_server 1.3.0+1 archive
1.3.0 Sep 23, 2014 Go to the documentation of http_multi_server 1.3.0 Download http_multi_server 1.3.0 archive
1.2.0 Aug 14, 2014 Go to the documentation of http_multi_server 1.2.0 Download http_multi_server 1.2.0 archive

All 13 versions...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Jan 17, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.9.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
88 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
94

Platforms

Detected platforms: Flutter, server

Multiple platform identified in libraries.

Suggestions

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use http_multi_server.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.13.0 <2.0.0
async >=1.2.0 <3.0.0 2.0.3
Transitive dependencies
collection 1.14.5
Dev dependencies
http >=0.11.0 <0.12.0
test >=0.12.0 <0.13.0