# `RTMP.Listener`
[🔗](https://github.com/Adeyeye93/rtmp/blob/v0.1.0/lib/rtmp/listener.ex#L1)

Starts an RTMP server.

Add it to your supervision tree:

    children = [
      {RTMP.Listener, port: 1935, handler: MyApp.RTMPHandler}
    ]

## Options

  * `:handler` (required) — a module implementing `RTMP.Handler`.
  * `:handler_options` — passed to `c:RTMP.Handler.init/2` for every
    connection. Default `[]`.
  * `:port` — TCP port. Default `1935`. Use `0` for a random free port
    (see `port/1`).
  * `:acceptors` — number of acceptor processes. Default `10`.
  * `:max_connections` — concurrent connections before new ones are
    refused. Default `16_384`.
  * `:limits` — per-connection limits, a keyword list or `RTMP.Limits`
    struct. See `RTMP.Limits` for options and defaults.
  * `:transport_options` — passed to `:gen_tcp` via ThousandIsland, e.g.
    `[ip: {127, 0, 0, 1}]` to bind to localhost only.
  * `:name` — registered name for the listener's supervisor.

Each connection runs in its own process; a failure in one never affects
the listener or any other connection.

# `port`

```elixir
@spec port(Supervisor.supervisor()) :: {:ok, :inet.port_number()} | :error
```

The port the listener is bound to — useful after starting with `port: 0`.

# `start_link`

```elixir
@spec start_link(keyword()) :: Supervisor.on_start()
```

Starts the listener. See the module docs for options.

# `stop`

```elixir
@spec stop(Supervisor.supervisor(), timeout()) :: :ok
```

Stops the listener, waiting up to `timeout` ms for connections to finish.
Open connections get `c:RTMP.Handler.handle_disconnect/2` with `:shutdown`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
