# `Quiver.Pool.HTTP2.Connection`
[🔗](https://github.com/edlontech/quiver/blob/main/lib/quiver/pool/http2/connection.ex#L1)

gen_state_machine process owning a single HTTP/2 connection.

Manages stream multiplexing, caller monitoring, and GOAWAY drain logic.
The process transitions from :connected to :draining when a GOAWAY is received
or the server closes the connection, completing in-flight requests before stopping.

# `t`

```elixir
@type t() :: %Quiver.Pool.HTTP2.Connection{
  config: keyword(),
  conn: Quiver.Conn.HTTP2.t() | nil,
  monitors: map(),
  origin: term(),
  pool_pid: pid() | nil,
  requests: map(),
  write_queue: [iodata()]
}
```

# `available_streams`

```elixir
@spec available_streams(pid()) :: non_neg_integer()
```

Returns the number of stream slots available on this connection.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

```elixir
@spec close(pid()) :: :ok
```

Closes the connection, failing any in-flight requests.

# `connected`

# `draining`

# `max_streams`

```elixir
@spec max_streams(pid()) :: non_neg_integer()
```

Returns the server's max concurrent streams setting.

# `open?`

```elixir
@spec open?(pid()) :: boolean()
```

Returns true if the connection is open and accepting new streams.

# `request`

```elixir
@spec request(pid(), atom(), String.t(), list(), iodata() | nil, keyword()) ::
  {:ok, Quiver.Response.t()} | {:error, term()}
```

Sends an HTTP/2 request and blocks until the response is complete.

# `start_link`

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

Starts the connection worker and performs the HTTP/2 handshake.

---

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