# RanchConnectionDrainer

This mini library implements connection draining for servers that use Ranch (Cowboy, Plug, Phoenix, and maybe others).

## Installation

If [available in Hex](, the package can be installed
by adding `ranch_connection_drainer` to your list of dependencies in `mix.exs`:

def deps do
    {:ranch_connection_drainer, "~> 0.1.0"}

Then add `{RanchConnectionDrainer, ranch_ref: my_ranch_ref, shutdown: my_drain_timeout}` to your application supervisor directly under your phoenix endpoint.


children = [
  {RanchConnectionDrainer, ranch_ref: MyPhoenixProject.Endpoint.HTTP, shutdown: 30_000}
Supervisor.init(children, opts)

The format of `ranch_ref` is: `[PhoenixEndpoint].[HTTP | HTTPS]`. Please open an issue if this is unclear.

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](