http_multi_server 2.1.0

  • Installing
  • Versions
  • 96

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 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.1.0 #

  • Add HttpMultiServer.bind static which centralizes logic around common local serving scenarios - handling a more flexible 'localhost' and listening on 'any' hostname.
  • Update SDK constraints to >=2.1.0 <3.0.0.

2.0.6 #

  • If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4 server open when throwing the exception.

2.0.5 #

  • Update SDK constraints to >=2.0.0-dev <3.0.0.

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.

Use this package as a library

1. Depend on it

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

  http_multi_server: ^2.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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.1.0 Jun 4, 2019 Go to the documentation of http_multi_server 2.1.0 Download http_multi_server 2.1.0 archive
2.0.6 Apr 25, 2019 Go to the documentation of http_multi_server 2.0.6 Download http_multi_server 2.0.6 archive
2.0.5 Jun 1, 2018 Go to the documentation of http_multi_server 2.0.5 Download http_multi_server 2.0.5 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

All 16 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jun 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18


Detected platforms: Flutter, other

Primary library: package:http_multi_server/http_multi_server.dart with components: io.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and http_multi_server.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
async >=1.2.0 <3.0.0 2.2.0
Transitive dependencies
collection 1.14.11
Dev dependencies
http ^0.12.0
pedantic ^1.4.0
test ^1.5.2