MDN Web Docs

Syntax

js

getStats()

Parameters

None.

Return value

A Promise that resolves to an object containing aggregated statistics for the group's members. The returned object has the following properties:

bytesAcknowledged

A positive integer indicating the number of bytes written to the group's members 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 unacknowledged byte of each member, are counted. This number can only increase and is always less than or equal to bytesSent.

bytesSent

A positive integer indicating the number of bytes written to the group's members 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 the group's members. This number can only increase.

Examples

Basic usage

The code snippet below uses await to wait on the Promise returned by getStats(), then logs the number of bytes that have been sent across the group's members but not yet acknowledged:

js

const stats = await sendGroup.getStats();
const bytesNotAcknowledged = stats.bytesSent - stats.bytesAcknowledged;
console.log(`Bytes sent but not yet acknowledged: ${bytesNotAcknowledged}`);

Specifications

Specification
WebTransport
# dom-webtransportsendgroup-getstats

Browser compatibility

See also

Help improve MDN

Yes No

Learn how to contribute

This page was last modified on by MDN contributors.

Read the original on developer.mozilla.org ↗