# `HTTP.Runtime.Stream`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v0.21.17/apps/http_runtime/lib/http/runtime/stream.ex#L1)

Internal logical HTTP/2 byte stream. The supervised stream task owns admission
and its reservation for its entire lifetime; the connection owner alone owns
the transport. Notifications are qualified by an opaque attempt generation.
DATA acknowledgements settle transport credit after bounded parser admission.
They are independent from application delivery acknowledgements. Subscribers
must monitor the returned task PID: a shared-runtime restart terminates tasks,
and its DOWN notification is the terminal signal when forwarding is unavailable.
Ordinary remote end releases after all DATA transport references are settled.
Extended CONNECT retains its reservation until both directions end or the
adapter cancels. Adapters submit one bounded write at a time and await :done
before another submission; progress reports transport-accepted bytes.

# `handle`

```elixir
@type handle() :: %{
  owner: pid(),
  id: pos_integer(),
  ref: reference(),
  protocol: :h2 | :h2c
}
```

# `acknowledge`

Settles the oldest DATA notification after bounded parser admission.

# `close`

Cancels only this stream; repeated cancellation is harmless.

# `half_close`

Half-closes the local tunnel direction after the previous write completes.

# `start`

```elixir
@spec start(HTTP.Request.t(), pid(), keyword()) ::
  {:ok, pid(), reference()} | {:error, term()}
```

# `write`

Submits one bounded write; progress is reported with the returned reference.

---

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