Skip to content

Commit

Permalink
RTCDataChannelStats - complete property docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Mar 24, 2024
1 parent 18840eb commit d52bb13
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 18 deletions.
29 changes: 29 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/bytesreceived/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "RTCDataChannelStats: bytesReceived property"
short-title: bytesReceived
slug: Web/API/RTCDataChannelStats/bytesReceived
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.bytesReceived
---

{{APIRef("WebRTC")}}

The **`bytesReceived`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns the total number of payload bytes received on the associated {{domxref("RTCDataChannel")}}.

Note that non-payload bytes, such as those for framing and in headers are not included.

## Value

A positive integer value indicating the total number of payload bytes received on the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCDataChannel")}}
29 changes: 29 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/bytessent/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "RTCDataChannelStats: bytesSent property"
short-title: bytesSent
slug: Web/API/RTCDataChannelStats/bytesSent
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.bytesSent
---

{{APIRef("WebRTC")}}

The **`bytesSent`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns the total number of payload bytes sent on the associated {{domxref("RTCDataChannel")}}.

Note that non-payload bytes, such as those for framing and in headers are not included.

## Value

A positive integer value indicating the total number of payload bytes sent on the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCDataChannel")}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "RTCDataChannelStats: dataChannelIdentifier property"
short-title: dataChannelIdentifier
slug: Web/API/RTCDataChannelStats/dataChannelIdentifier
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.dataChannelIdentifier
---

{{APIRef("WebRTC")}}

The **`dataChannelIdentifier`** property of the {{domxref("RTCDataChannelStats")}} dictionary containing the {{domxref("RTCDataChannel.id", "id")}} of the associated `RTCDataChannel` providing these statistics.

Using the `dataChannelIdentifier`, you can correlate this statistics object to a particular {{domxref("RTCDataChannel")}}.

## Value

A string containing the same value as the {{domxref("RTCDataChannel.id")}} property of the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
31 changes: 13 additions & 18 deletions files/en-us/web/api/rtcdatachannelstats/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ The **`RTCDataChannelStats`** dictionary of the [WebRTC API](/en-US/docs/Web/API

The report can be obtained by iterating the {{domxref("RTCStatsReport")}} returned by {{domxref("RTCPeerConnection.getStats()")}} until you find an entry with the [`type`](#type) of `data-channel`.

The data channels statistics can be correlated to a particular channel by comparing the [`dataChannelIdentifier`](#datachannelidentifier) property to a matching {{domxref("RTCDataChannel.id")}}.
The data channels statistics may be correlated to a particular channel by comparing the [`dataChannelIdentifier`](#datachannelidentifier) property to a matching {{domxref("RTCDataChannel.id")}}.

## Instance properties

- {{domxref("RTCDataChannelStats.label", "label")}}
- {{domxref("RTCDataChannelStats.bytesSent", "bytesSent")}} {{optional_inline}}
- : A positive integer value indicating the total number of payload bytes sent on the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.bytesReceived", "bytesReceived")}} {{optional_inline}}
- : A positive integer value indicating the total number of payload bytes received on the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.dataChannelIdentifier", "dataChannelIdentifier")}} {{optional_inline}}
- : A positive integer value containing the {{domxref("RTCDataChannel.id", "id")}} of the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.label", "label")}} {{optional_inline}}
- : A string containing the {{domxref("RTCDataChannel.label", "label")}} of the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.protocol", "protocol")}}
- {{domxref("RTCDataChannelStats.messagesReceived", "messagesReceived")}} {{optional_inline}}
- : A positive integer value indicating the total number of [`message` events](/en-US/docs/Web/API/RTCDataChannel/message_event) fired for received messages on the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.messagesSent", "messagesSent")}} {{optional_inline}}
- : A positive integer value indicating the total number of [`message` events](/en-US/docs/Web/API/RTCDataChannel/message_event) fired for sent messages on the channel.
- {{domxref("RTCDataChannelStats.protocol", "protocol")}} {{optional_inline}}
- : A string containing the {{domxref("RTCDataChannel.protocol", "protocol")}} of the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.dataChannelIdentifier", "dataChannelIdentifier")}}
- : A positive integer value containing the {{domxref("RTCDataChannel.id", "id")}} of the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.state", "state")}}
- : The {{domxref("RTCDataChannel.readyState", "readyState")}} of the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.messagesSent", "messagesSent")}}
- : A positive integer value indicating the total number of messages sent on the channel.
- {{domxref("RTCDataChannelStats.bytesSent", "bytesSent")}}
- : A positive integer value indicating the total number of payload bytes sent on the associated `RTCDataChannel`.
- {{domxref("RTCDataChannelStats.messagesReceived", "messagesReceived")}}
- : A positive integer value indicating the total number of messages received on the associated.
- {{domxref("RTCDataChannelStats.bytesReceived", "bytesReceived")}}
- : A positive integer value indicating the total number of payload bytes received on the associated `RTCDataChannel`.

### Common instance properties

Expand Down Expand Up @@ -68,8 +68,3 @@ stats.forEach((report) => {
## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCStatsReport")}}
- {{domxref("RTCRtpCodecParameters")}}
29 changes: 29 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/label/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "RTCDataChannelStats: label property"
short-title: label
slug: Web/API/RTCDataChannelStats/label
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.label
---

{{APIRef("WebRTC")}}

The **`label`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns the {{domxref("RTCDataChannel.label", "label")}} of the associated data channel.

The value of the label need not be unique, and its meaning is defined by the website or app when it creates the data channel.

## Value

A string containing the same value as the {{domxref("RTCDataChannel.label")}} property of the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCDataChannel.label")}}
23 changes: 23 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/messagesreceived/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "RTCDataChannelStats: messagesReceived property"
short-title: messagesReceived
slug: Web/API/RTCDataChannelStats/messagesReceived
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.messagesReceived
---

{{APIRef("WebRTC")}}

The **`messagesReceived`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns the total number of [`message` events](/en-US/docs/Web/API/RTCDataChannel/message_event) fired for received messages on the associated {{domxref("RTCDataChannel")}}.

## Value

A positive integer value indicating the total number of `message` events for inbound data on the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
23 changes: 23 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/messagessent/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "RTCDataChannelStats: messagesSent property"
short-title: messagesSent
slug: Web/API/RTCDataChannelStats/messagesSent
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.messagesSent
---

{{APIRef("WebRTC")}}

The **`messagesSent`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns the total number of [`message` events](/en-US/docs/Web/API/RTCDataChannel/message_event) fired for sent messages on the associated {{domxref("RTCDataChannel")}}.

## Value

A positive integer value indicating the total number of `message` events for outbound data on the the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
31 changes: 31 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/protocol/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "RTCDataChannelStats: protocol property"
short-title: protocol
slug: Web/API/RTCDataChannelStats/protocol
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.protocol
---

{{APIRef("WebRTC")}}

The **`protocol`** property of the {{domxref("RTCDataChannelStats")}} dictionary returns a string containing the {{domxref("RTCDataChannel.protocol", "protocol")}} of the associated data channel.

The value is defined by the website or app when it creates the data channel.

## Value

A string containing the same value as the {{domxref("RTCDataChannel.protocol")}} property of the associated data channel.

If no protocol was defined, this will be the empty string ("").

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCDataChannel.protocol")}}
29 changes: 29 additions & 0 deletions files/en-us/web/api/rtcdatachannelstats/state/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "RTCDataChannelStats: state property"
short-title: state
slug: Web/API/RTCDataChannelStats/state
page-type: web-api-instance-property
browser-compat: api.RTCStatsReport.type_data-channel.state
---

{{APIRef("WebRTC")}}

The **`state`** property of the `RTCDataChannelStats` dictionary returns a string that indicates the {{domxref("RTCDataChannel.readyState","readyState")}} of the data channel's underlying data connection: `connecting`, `open`, `closing` or `closed`.

Note that this property is required.

## Values

A string containing the same value as the {{domxref("RTCDataChannel.readyState")}} property of the associated data channel.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("RTCDataChannel.readyState")}}

0 comments on commit d52bb13

Please sign in to comment.