v160 · webtransport · getStats()
One snapshot, every unit
The canonical call: open a session, await transport.getStats(), read the dictionary. It is a one-shot asynchronous snapshot of the underlying QUIC connection — RTT in milliseconds (DOMHighResTimeStamp), send-rate estimate in bits per second (or null), and a nested, always-present datagrams dictionary of counters. This page shows the raw object and a decoded, unit-labelled reading of each member side by side, and lets you take a second snapshot to see that the numbers are a copy, not a live view.
Availability. Chrome 160 ships WebTransport.prototype.getStats() enabled by default — the Blink runtime feature WebTransportStats is status: "stable" in runtime_enabled_features.json5. On an older Chrome the method is absent: enable chrome://flags/#enable-experimental-web-platform-features and relaunch, or launch with --enable-blink-features=WebTransportStats (both verified on Chrome 153). Real numbers also need a WebTransport server you can reach: this showcase has no HTTP/3 server of its own, so the default endpoint is a public echo server. If your network blocks QUIC the attempt fails with the real error, shown verbatim — never a made-up result. Running your own server is a few lines; see the local echo server recipe.
1 · Is the method here?
The exact surface: typeof WebTransport.prototype.getStats === "function". This can genuinely come back false — Chrome 153 without a flag has no such method.
2 · Open a session and call getStats()
Raw JSON.stringify(stats)
—
code path
const transport = new WebTransport(url);
await transport.ready;
const stats = await transport.getStats(); // a snapshot, resolved asynchronously
stats.smoothedRtt; // ms (DOMHighResTimeStamp) — absent until QUIC has an RTT sample
stats.minRtt; // ms
stats.rttVariation; // ms
stats.estimatedSendRate; // bits per second, or null when there is no estimate
stats.datagrams; // required: { droppedIncoming, expiredIncoming, expiredOutgoing, lostOutgoing }
// Members the UA does not expose are simply absent — always check before use:
if ("bytesSent" in stats) { /* Chromium does not expose byte/packet totals */ }