# `QuicHttp3.Session`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v1.0.0/apps/elixir_quic_http3/lib/quic_http3/session.ex#L1)

Caller-driven HTTP/3 session with resumable QUIC admission.

Mutating failures return the advanced session. Call `resume/1` to reconcile an
unknown operation, or retry a definitely blocked operation after credit changes.
Unknown operations are never replayed, including after result-cache eviction.
A detected HTTP/3 connection error `{:http3_error, :connection, code, reason}`
first closes the QUIC connection with that application error code (best
effort under the operation deadline) and is then returned.
Definitely credit-blocked stream writes are split into smaller ordered
fragments under the original deadline; `max_frame` remains an upper bound.
Native query calls and DNS retain their transport timeout bounds; the session
deadline is an admission/reconciliation budget, not a shorter wall-clock bound.

QPACK: `:qpack_max_table_capacity` (default 4096) and `:qpack_blocked_streams`
(default 16) are advertised in SETTINGS. A nonzero capacity opens local QPACK
encoder and decoder streams, applies peer encoder instructions to a bounded
dynamic table, holds blocked sections without reading further from their
streams, and sends Section Acknowledgment, Stream Cancellation and Insert
Count Increment through ordinary stream-write admission. `0`/`0` keeps the
static/literal profile without QPACK streams. The local encoder is always
static/literal.

WebTransport: `webtransport: true` (or router limits as a keyword list)
advertises the draft-17 client SETTINGS and admits exactly one
`webtransport-h3` extended CONNECT after the peer's draft-17 SETTINGS and the
connection's negotiated reliable reset and QUIC DATAGRAM support are
confirmed. Peer WT streams and datagrams are associated through
`QuicHttp3.WebTransportRouter`; deliveries are `{:wt, connect_ref, event}`
poll events whose credit is released by `webtransport_acknowledge/2`.
Closing the session, or the CONNECT stream ending, resets and stops every
associated stream with WT_SESSION_GONE.

Early data (beta): before the handshake completes, `request/4` with
`early_data: remembered_settings` admits a GET, HEAD or OPTIONS request
without a body as replayable QUIC 0-RTT stream operations, provided the
connection offered 0-RTT. `remembered_settings` are the peer SETTINGS the
caller remembered for the resumption partition; the request must fit their
`SETTINGS_MAX_FIELD_SECTION_SIZE`. Control and QPACK streams are opened only
after the handshake. When `open/1` finds 0-RTT rejected, every early request
is re-sent once on a fresh stream under the same request reference. When
0-RTT was accepted, a peer SETTINGS frame that omits or reduces a remembered
non-default value this client understands is an `H3_SETTINGS_ERROR`
connection error (RFC 9114 Section 7.2.4.2). At most eight requests are
admitted early per connection.

# `failure`

```elixir
@type failure() ::
  {:error, t(), term()} | {:blocked, t(), term()} | {:unknown, t(), reference()}
```

# `t`

```elixir
@type t() :: %QuicHttp3.Session{
  aborted_operation: term(),
  cleanup: term(),
  connection: term(),
  continuations: term(),
  control: term(),
  control_stream: term(),
  deadline: term(),
  early: term(),
  max_encoded_headers: term(),
  max_fields: term(),
  max_frame: term(),
  max_header_bytes: term(),
  max_retained_bytes: term(),
  next_request: term(),
  next_stream_id: term(),
  open?: term(),
  peer_streams: term(),
  pending: term(),
  qpack: term(),
  qpack_blocked: term(),
  qpack_blocked_streams: term(),
  qpack_decoder_stream: term(),
  qpack_encoder_stream: term(),
  qpack_known: term(),
  qpack_max_table_capacity: term(),
  qpack_out: term(),
  qpack_streams: term(),
  requests: term(),
  retired: term(),
  runnable: term(),
  timeout: term(),
  transport: term(),
  work: term(),
  wt: term()
}
```

# `abort`

Terminate transport resources without replaying pending application work.

This does not prove an indeterminate request was unsent. The returned session
retains its abandoned operation identity in `aborted_operation`.

# `cancel`

# `close`

# `connect`

# `early_data?`

Whether `ref` was carried in QUIC 0-RTT data that the server accepted.

# `early_offered?`

Whether the connection currently offers QUIC 0-RTT for early requests.

# `extended_connect`

Opens an explicitly negotiated extended CONNECT without closing its sending direction.

# `migrate`

Admits explicit client migration to the concrete `local` `{ip, port}` (beta).

Returns `{:ok, session, ref}` once the transport admitted migration; the
outcome later arrives from `poll/3` as `{:migration, ref, {:ok, actual_local}
| {:error, reason}}`. The migration deadline is the operation deadline. A
transport without migration returns `:migration_unsupported`.

# `new`

# `open`

# `poll`

# `ready`

# `request`

# `reset_send`

# `resume`

# `resume`

# `resumed?`

Whether the established connection resumed a TLS session.

# `send_data`

# `send_trailers`

Sends ordered request trailing HEADERS with FIN through resumable admission.

# `suspend_blocked`

# `webtransport_acknowledge`

Releases delivery credit retained for a WT event receipt.

# `webtransport_close`

Sends CLOSE_WEBTRANSPORT_SESSION and FIN on the CONNECT stream.

# `webtransport_datagram`

Sends one HTTP DATAGRAM associated with the accepted WT session.

# `webtransport_info`

Returns the accepted WT session identity and maximum DATAGRAM payload.

# `webtransport_open`

Opens a session-associated WT stream; returns its QUIC stream ID as key.

# `webtransport_reset`

Resets the send side with RESET_STREAM_AT, reliably delivering the WT prefix.

# `webtransport_send`

Writes raw WT stream bytes; FIN closes the send side.

# `webtransport_stop`

Aborts the receive side with STOP_SENDING carrying a mapped application code.

---

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