webtransport_h3 (webtransport v0.3.1)
View SourceMinimal runtime wrapper for an HTTP/3 WebTransport session.
The HTTP/3 CONNECT stream is managed through quic_h3. Native WebTransport streams and datagrams use the underlying QUIC connection.
Summary
Functions
Send a CLOSE_WEBTRANSPORT_SESSION capsule and FIN the CONNECT stream.
Decode an incoming QUIC datagram into session ID and payload.
Decode the session ID and stream kind from the start of an incoming stream.
Send a DRAIN_WEBTRANSPORT_SESSION capsule to signal graceful shutdown.
Return the HTTP/3 connection pid.
Create a new H3 transport state with no router.
Create a new H3 transport state, optionally attaching a stream router.
Open a new bidirectional WebTransport stream on the QUIC connection.
Open a new unidirectional WebTransport stream on the QUIC connection.
Return the peer's advertised WebTransport settings.
Return the underlying QUIC connection pid.
Reset a stream with the given application error code mapped to the QUIC error space.
Return the stream router pid, or undefined if none is set.
Send data on a stream. Routes through H3 for the CONNECT stream, QUIC for native streams.
Send an unreliable datagram, prefixed with the quarter stream ID.
Return the WebTransport session ID (the CONNECT stream ID).
Request that the peer stop sending on a stream with the given error code.
Return a new state with updated peer settings.
Return a new state with the given stream router pid.
Types
Functions
-spec close_session(state(), non_neg_integer(), binary()) -> ok | {error, term()}.
Send a CLOSE_WEBTRANSPORT_SESSION capsule and FIN the CONNECT stream.
-spec decode_datagram(binary()) -> {ok, non_neg_integer(), binary()} | {more, pos_integer()} | {error, term()}.
Decode an incoming QUIC datagram into session ID and payload.
-spec decode_stream_header(binary()) -> {ok, non_neg_integer(), wt_h3_capsule:stream_kind(), binary()} | {more, pos_integer()} | {error, term()}.
Decode the session ID and stream kind from the start of an incoming stream.
Send a DRAIN_WEBTRANSPORT_SESSION capsule to signal graceful shutdown.
Return the HTTP/3 connection pid.
-spec new(pid(), non_neg_integer()) -> state().
Create a new H3 transport state with no router.
-spec new(pid(), non_neg_integer(), undefined | pid()) -> state().
Create a new H3 transport state, optionally attaching a stream router.
-spec open_bidi_stream(state()) -> {ok, non_neg_integer(), state()} | {error, term()}.
Open a new bidirectional WebTransport stream on the QUIC connection.
-spec open_uni_stream(state()) -> {ok, non_neg_integer(), state()} | {error, term()}.
Open a new unidirectional WebTransport stream on the QUIC connection.
Return the peer's advertised WebTransport settings.
Return the underlying QUIC connection pid.
-spec reset_stream(state(), non_neg_integer(), non_neg_integer(), non_neg_integer()) -> ok | {error, term()}.
Reset a stream with the given application error code mapped to the QUIC error space.
Return the stream router pid, or undefined if none is set.
-spec send(state(), non_neg_integer(), iodata(), boolean()) -> ok | {error, term()}.
Send data on a stream. Routes through H3 for the CONNECT stream, QUIC for native streams.
Send an unreliable datagram, prefixed with the quarter stream ID.
-spec session_id(state()) -> non_neg_integer().
Return the WebTransport session ID (the CONNECT stream ID).
-spec stop_sending(state(), non_neg_integer(), non_neg_integer()) -> ok | {error, term()}.
Request that the peer stop sending on a stream with the given error code.
Return a new state with updated peer settings.
Return a new state with the given stream router pid.