Expand description
WebTransport is a protocol for client-server communication over QUIC.
It’s available in the browser as an alternative to HTTP and WebSockets.
WebTransport is layered on top of HTTP/3 which is then layered on top of QUIC.
This crate implements the web-transport-trait session and stream traits for iroh connections and streams. A web-transport-iroh session can either use an iroh connection directly, or run HTTP/3 over the iroh connection. The latter includes the WebTransport request-response handshake, through which a request target and headers can be set.
§Limitations
WebTransport is able to be pooled with HTTP/3 and multiple WebTransport sessions. This crate avoids that complexity, doing the bare minimum to support a single WebTransport session that owns the entire QUIC connection. If you want to support multiple WebTransport sessions over the same QUIC connection… you should just dial a new QUIC connection instead.
Re-exports§
pub use http;pub use iroh;pub use web_transport_trait as generic;
Structs§
- Client
- A client for connecting to an iroh WebTransport endpoint.
- Closed
Stream - An error indicating the stream was already closed.
- Connected
- An established HTTP/3 CONNECT session with both request and response.
- Connecting
- An in-progress HTTP/3 CONNECT handshake, awaiting a response.
- H3Request
- An H3 WebTransport handshake, SETTINGS exchanged and CONNECT accepted, awaiting server decision (respond OK / reject).
- H3Session
Accept - Quic
Request - A QUIC-only WebTransport handshake, awaiting server decision.
- Recv
Stream - A stream that can be used to receive bytes. See
iroh::endpoint::RecvStream. - Send
Stream - A stream that can be used to send bytes. See
iroh::endpoint::SendStream. - Session
- An established WebTransport session, acting like a full QUIC connection. See
iroh::endpoint::Connection. - Settings
- Maintains the HTTP/3 control stream by holding references to the send/recv streams.
Enums§
- Client
Error - An error returned when connecting to a WebTransport endpoint.
- Connect
Error - An error during the HTTP/3 CONNECT handshake.
- Read
Error - An error when reading from
crate::RecvStream. Similar toiroh::endpoint::ReadError. - Read
Exact Error - An error returned by
crate::RecvStream::read_exact. Similar toiroh::endpoint::ReadExactError. - Read
ToEnd Error - An error returned by
crate::RecvStream::read_to_end. Similar toiroh::endpoint::ReadToEndError. - Server
Error - An error returned when receiving a new WebTransport session.
- Session
Error - An error returned by
crate::Session, split between underlying QUIC errors and WebTransport errors. - Settings
Error - An error during the HTTP/3 SETTINGS frame exchange.
- WebTransport
Error - An error that can occur when reading/writing the WebTransport stream header.
- Write
Error - An error when writing to
crate::SendStream. Similar toiroh::endpoint::WriteError.
Constants§
- ALPN_H3
- The HTTP/3 ALPN is required when negotiating a QUIC connection.