files/en-us/web/api/webtransport/getstats/index.md
{{APIRef("WebTransport API")}}{{SecureContext_Header}} {{AvailableInWorkers}}
The getStats() method of the {{domxref("WebTransport")}} interface asynchronously returns an object containing HTTP/3 connection statistics.
getStats()
None.
A {{jsxref("Promise")}} that resolves to an object containing HTTP/3 connection statistics. The returned object may have the following properties/statistics:
timestamp
bytesSent
packetsSent
packetsLost
numOutgoingStreamsCreated
numIncomingStreamsCreated
bytesReceived
packetsReceived
smoothedRtt
rttVariation
minRtt
datagrams
timestamp
expiredOutgoing
outgoingMaxAge.droppedIncoming
readable stream receive queue.lostOutgoing
The example below uses await to wait on the {{jsxref("Promise")}} returned by getStats().
When the promise fulfills, the result for the bytesSent property in the stats object is logged to the console.
const stats = await transport.getStats();
console.log(`Bytes send: ${stats.bytesSent}`);
{{Specifications}}
{{Compat}}