WebTransportSendStream: getStats() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The getStats() method of the WebTransportSendStream interface asynchronously returns an object containing statistics for the current stream.

The statistics include the total number of bytes written to the stream, the number that have been sent (ignoring packet overhead), and the number of bytes that have been set at least once, and the number that have been acknowledged (up until the first sequentially-ordered non-acknowledged byte). It therefore provides a measure of how quickly the application is sending bytes to the server on this particular stream.

Syntax

js
getStats()

Parameters

None.

Return value

A Promise that resolves to an object containing statistics about the current stream. The returned object has the following properties:

bytesAcknowledged

A positive integer indicating the number of bytes written to this stream that have been sent and acknowledged as received by the server, using QUIC's ACK mechanism. Only sequential bytes up to, but not including, the first non-acknowledged byte, are counted. This number can only increase and is always less than or equal to bytesSent. When the connection is over HTTP/2, the value will match bytesSent.

bytesSent

A positive integer indicating the number of bytes written to this stream that have been sent at least once (but not necessarily acknowledged). This number can only increase, and is always less than or equal to bytesWritten. Note that this count does not include bytes sent as network overhead (such as packet headers).

bytesWritten

A positive integer indicating the number of bytes successfully written to this stream. This number can only increase.

Examples

The code snippet below uses await to wait on the Promise returned by getStats(). When the promise fulfills, the result for the number of bytes that have been sent but not acknowledged is logged to the console.

js
const stats = await stream.getStats();
const bytesNotReceived = stats.bytesWritten - stats.bytesAcknowledged;
console.log(`Bytes still successfully sent: ${bytesNotReceived}`);

Specifications

Specification
WebTransport
# dom-webtransportsendstream-getstats

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
getStats
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 114 (Release date: 2023-06-06)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 26.4 (Release date: 2026-03-24)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 114 (Release date: 2023-06-06)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 26.4 (Release date: 2026-03-24)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 26.4 (Release date: 2026-03-24)
footnote Full support
Deno – No support
Deno 2.2 (Release date: 2025-02-19)
disabled
disabled From version 2.2 users must explicitly set the --unstable-net runtime flag.

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
User must explicitly enable this feature.