WebTransport: 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 WebTransport interface asynchronously returns an object containing HTTP/3 connection statistics.

Syntax

js
getStats()

Parameters

None.

Return value

A Promise that resolves to an object containing HTTP/3 connection statistics. The returned object may have the following properties/statistics:

timestamp

A DOMHighResTimeStamp indicating the timestamp at which the statistics were gathered, relative to Jan 1, 1970, UTC.

bytesSent

A positive integer indicating the number of bytes sent on the QUIC connection, including retransmissions. Note that this count does not include additional data from protocols used by QUIC, such as UDP, or any other outer framing.

packetsSent

A positive integer indicating the number of packets sent on the QUIC connection, including those that are known to have been lost.

packetsLost

A positive integer indicating the number of packets lost on the QUIC connection. This value will increase as packets are declared lost, and decrease if they are subsequently received.

numOutgoingStreamsCreated

A positive integer indicating the number of outgoing QUIC streams created on the QUIC connection.

numIncomingStreamsCreated

A positive integer indicating the number of incoming QUIC streams created on the QUIC connection.

bytesReceived

A positive integer indicating the total number of bytes received on the QUIC connection. This count includes duplicate data from streams, but does not include additional data for protocols used by QUIC, such as UDP, or any other outer framing.

packetsReceived

A positive integer indicating the total number of packets received on the QUIC connection, including packets that were not processable.

smoothedRtt

A DOMHighResTimeStamp containing the smoothed round-trip time (RTT) currently observed on the connection, calculated as an exponentially weighted moving average of an endpoint's RTT samples after taking account of acknowledgement delays.

rttVariation

A DOMHighResTimeStamp containing the mean variation in round-trip time samples currently observed on the connection.

minRtt

A DOMHighResTimeStamp containing the minimum round-trip time observed on the entire connection.

datagrams

An object containing statistics for datagram transmission over the connection. The object has the following properties:

timestamp

A DOMHighResTimeStamp indicating the timestamp at which the statistics were gathered, relative to Jan 1, 1970, UTC.

expiredOutgoing

A positive integer indicating the number of datagrams that were dropped from the queue for sending because they expired. Note that the maximum age before a datagram in the send-queue expires can be found in outgoingMaxAge.

droppedIncoming

A positive integer indicating the number incoming datagrams that were dropped. Incoming datagrams are dropped if the application does not read them before new datagrams overflow the readable stream receive queue.

lostOutgoing

A positive integer indicating the number of sent datagrams that were declared lost. Note that a datagram may be declared lost if, for example, no acknowledgement arrived within a timeout, or an acknowledgement for a later datagram was received first.

Examples

The example below uses await to wait on the Promise returned by getStats(). When the promise fulfills, the result for the bytesSent property in the stats object is logged to the console.

js
const stats = await transport.getStats();
console.log(`Bytes send: ${stats.bytesSent}`);

Specifications

Specification
WebTransport
# dom-webtransport-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
footnote See bug 41492543
Edge – No support
Edge
footnote
footnote See bug 41492543
Firefox – Partial support
Firefox 114 (Release date: 2023-06-06)
footnote Partial support
footnote Method is defined but throws a not-implemented error.
Opera – No support
Opera
footnote
footnote See bug 41492543
Safari – Full support
Safari 26.4 (Release date: 2026-03-24)
footnote Full support
Chrome Android – No support
Chrome Android
footnote
footnote See bug 41492543
Firefox for Android – Partial support
Firefox for Android 114 (Release date: 2023-06-06)
footnote Partial support
footnote Method is defined but throws a not-implemented error.
Opera Android – No support
Opera Android
footnote
footnote See bug 41492543
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
footnote See bug 41492543
WebView Android – No support
WebView Android
footnote
footnote See bug 41492543
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
Partial support
Partial support
No support
No support
See implementation notes.
User must explicitly enable this feature.