WebTransport Explained: Streams and Datagrams over HTTP/3
WebTransport gives browser applications a way to exchange real-time data with a server using several independent streams and, when supported, unreliable datagrams. Developers building multiplayer experiences, live dashboards, or interactive media systems can use it when one ordered connection is too restrictive. This explainer covers how WebTransport fits over HTTP, how it differs from WebSockets and WebRTC, and what a client and server must support before it is useful in production.
Why WebTransport Is Being Discussed
Interactive browser applications increasingly mix durable actions with frequent updates that lose value quickly. HTTP/3 and QUIC provide transport capabilities that make independent streams and unreliable datagrams available to web applications through a browser API. WebTransport is therefore relevant to developers deciding whether one connection can serve both kinds of traffic. Its practical value depends on browser support, server implementations, and network paths that permit the required transport; it is not a reason to replace a working WebSocket service by default.
What Is WebTransport?
WebTransport is a web API and protocol mapping for bidirectional communication between a browser and a server. It lets an application create reliable streams and send datagrams that may be lost, rather than requiring all application data to share one reliable, ordered byte stream. The W3C WebTransport specification defines the browser-facing interfaces and how a session uses an underlying HTTP connection. The MDN WebTransport reference describes the browser API for opening a session to a compatible server.
In common browser deployments, WebTransport uses HTTP/3 over QUIC. HTTP/3 establishes the session using an extended CONNECT request, while QUIC provides independently ordered streams and encrypted transport. The IETF HTTP/3 mapping specification describes how that session is established. A WebTransport mapping can also use HTTP/2 in specifications, but support depends on the browser and server implementation. WebTransport is not a replacement for all HTTP requests: it is a persistent, application-level session for interactive data exchange.
Why WebTransport Exists
Web applications often need different delivery behavior for different data. A chat message or a command to move a player should arrive reliably and in order. A position update generated a few milliseconds later can make an older update obsolete; waiting for retransmission may be worse than dropping it. A single communication mode forces developers either to accept unnecessary delay or build extra connections and custom recovery logic.
WebSockets provide full-duplex browser-to-server communication and remain a practical choice for many applications. They preserve message boundaries at the API, but their messages travel over one ordered TCP connection. If TCP must retransmit a lost segment, later bytes on that connection cannot be delivered to the application first. That behavior can delay fresh data behind stale data even when the application could have used a newer update.
WebTransport exposes more choices: create multiple streams with independent ordering, or send datagrams where occasional loss is acceptable. The HTTP Datagrams and Capsule Protocol specification, RFC 9297, defines a way for HTTP extensions to carry potentially unreliable datagrams. It is a building block for HTTP transports, not a complete description of WebTransport by itself.
How WebTransport Works
A browser constructs a WebTransport object with a secure server URL. The client and server negotiate a WebTransport session through HTTP; with HTTP/3, this uses QUIC, which is specified in RFC 9000. The browser’s ready promise resolves when the session is established, or rejects if the connection or protocol negotiation fails. The server must explicitly implement WebTransport and accept the session; a regular HTTPS endpoint that supports HTTP/3 is not automatically a WebTransport server.
Within a session, the client and server can open bidirectional streams for request-and-response exchanges or unidirectional streams when data only needs to flow one way. Stream data is reliable and ordered within that stream. Multiple streams can make progress independently, so a lost packet affecting one stream does not impose TCP-style ordering on every other stream. QUIC still applies congestion control, and loss can delay data on the affected stream.
The datagrams interface carries discrete payloads without retransmission guarantees. A datagram may arrive late, be dropped, or be unavailable when the path or peer does not support the needed capability. Applications should keep datagrams within the negotiated maximum size and should not place essential state in them unless they have their own recovery strategy. The network still has to carry the packets; unreliable does not mean unregulated or congestion-free.
| Feature | WebSocket | WebTransport | WebRTC data channel |
|---|---|---|---|
| Typical connection | Browser to server over a persistent TCP connection | Browser to server through an HTTP session, commonly HTTP/3 over QUIC | Peer-to-peer or relayed connection negotiated through ICE |
| Reliable data | Ordered messages on one connection | Reliable, ordered streams; independent streams can progress separately | Reliable delivery is configurable per data channel |
| Unreliable data | Not part of the standard WebSocket message service | Datagrams when supported by the session | Unordered or partially reliable data can be configured |
| Media support | Application handles media encoding and delivery | Application handles media encoding and delivery | Includes real-time audio/video APIs as well as data channels |
| Server requirements | WebSocket handshake and connection handling | WebTransport-capable server and compatible HTTP transport | Signaling, ICE checks, and optional STUN or TURN relays |
| Best fit | Broadly supported interactive messaging | Browser-to-server apps that need several delivery modes | Real-time peer communication, especially audio or video |
Choose based on the communication pattern, not just a benchmark. A WebSocket is simpler when every message needs reliable ordered delivery. WebTransport is useful when the application benefits from independent streams or disposable datagrams and can deploy a compatible endpoint. WebRTC is designed for peer communication and media, not as a drop-in server messaging API. For background on the underlying transport, see QUIC and HTTP/3 and how HTTP/3 changes the web transport stack.
Components and Key Concepts
- Session: The long-lived association between a client and a server. It is established over a supported HTTP transport and can be closed by either side.
- Reliable stream: A sequence of bytes delivered in order within that stream. Applications define their own framing, message format, and meaning; a stream read is not guaranteed to match a write boundary.
- Datagram: A discrete, unreliable payload. Use it for updates that become stale quickly, and design the application to tolerate loss and reordering.
- Transport mapping: The HTTP and underlying transport combination used for a session. The browser API does not guarantee that every browser, proxy, or server supports every mapping.
- Origin and TLS checks: WebTransport uses secure connections and browser security rules. Server certificates, origin policy, authentication, authorization, and resource limits still need deliberate configuration.
Streams are not free parallel channels with unlimited capacity. The peer can apply flow control, the browser can reject stream creation, and a server must limit concurrent sessions and resource use. A client must handle closing, timeouts, peer errors, and interrupted networks. Authentication should be established using the server’s supported mechanisms, and a long-running session should be authorized for the particular user and action rather than treated as trusted merely because its TLS connection succeeded.
Real-World Use Cases
- Multiplayer games: Send frequent player positions as datagrams, while keeping match setup, inventory changes, and other important actions on reliable streams.
- Live telemetry: Transmit the latest sensor or dashboard values without queuing a backlog of readings that are already outdated.
- Interactive browser tools: Keep independent streams for separate tasks, such as progress events and a larger result, rather than making one response block another.
- Low-latency collaboration: Deliver ephemeral pointer or cursor updates as datagrams while sending document edits through a reliable path with application-level conflict handling.
These examples only help when loss tolerance is explicit. A payment, configuration change, or other state-changing operation should not rely on a best-effort datagram. Use reliable delivery and application-level acknowledgments or idempotency where the operation requires confirmation.
Getting Started: Check the Browser and Open a Session
WebTransport requires a secure context and a server that implements the protocol, has a valid certificate, and accepts a WebTransport session at the chosen URL. Check browser support before creating the object. The example below expects a real endpoint configured to respond to a WebTransport stream with application data; example.com is a placeholder, not a public test service.
if (!('WebTransport' in window)) {
throw new Error('This browser does not expose the WebTransport API');
}
const transport = new WebTransport('https://example.com/realtime');
await transport.ready;
const stream = await transport.createBidirectionalStream();
const writer = stream.writable.getWriter();
const reader = stream.readable.getReader();
const encoder = new TextEncoder();
const decoder = new TextDecoder();
await writer.write(encoder.encode('subscribe:prices\n'));
const { value, done } = await reader.read();
if (!done) {
console.log(decoder.decode(value));
}
reader.releaseLock();
writer.releaseLock();
await transport.close();
The server must understand the application protocol represented by subscribe:prices; WebTransport only moves bytes and does not define a subscription format. This small example reads one response chunk to keep the flow visible. A production client should continue reading as needed, handle stream closure and errors, and cancel or close resources when the user leaves the feature.
To test datagrams, both endpoints must support them and the server must agree on how to interpret each payload. Check transport.datagrams.maxDatagramSize before writing, keep payloads small, and design the receiver to tolerate missing updates. For general troubleshooting, first verify the certificate and endpoint URL, then confirm the browser exposes the API and that the server logs a WebTransport session rather than only an ordinary HTTP/3 request. A successful HTTP/3 page load alone does not prove that the server accepts WebTransport.
Common Misconceptions
“WebTransport makes every update faster.”
It provides delivery options, not a latency guarantee. Congestion, loss, server processing, and application queues still affect timing. A datagram can avoid waiting for retransmission, but it can also be lost and never reach the application.
“A datagram is just UDP with no rules.”
WebTransport datagrams use a negotiated HTTP transport and inherit the security and congestion behavior of the underlying transport. The application still needs to respect size limits, handle loss, and avoid using datagrams for operations that must be confirmed.
“WebTransport replaces WebSockets and WebRTC.”
Each technology solves a different communication problem. WebSockets remain an effective option for reliable browser-to-server messaging. WebRTC supplies peer-connection and real-time media capabilities. WebTransport is most relevant when a browser-to-server session needs multiple reliable streams, datagrams, or both. Compare its tradeoffs with WebSocket implementation patterns and WebRTC for video conferencing before choosing.
Related Articles
- QUIC and HTTP/3
- HTTP/3 vs HTTP/2 vs HTTP/1.1
- WebSocket implementation patterns
- WebRTC for video conferencing
Changelog
- 2026-10-14: First published.

