WebRTC SCTP information
The sctp read-only property of the RTCPeerConnection interface returns an RTCSctpTransport describing the SCTP transport over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null.
The SCTP transport is used for transmitting and receiving data for any and all RTCDataChannels on the peer connection.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 76 | 79 | 113 | 15.4 | 76 | 15.4 | |
| The sctp read-only property of the RTCPeerConnection interface returns an RTCSctpTransport describing the SCTP transport over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
| The maxChannels read-only property of the RTCSctpTransport interface indicates the maximum number of RTCDataChannel objects that can be opened simultaneously. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
| The maxMessageSize read-only property of the RTCSctpTransport interface indicates the maximum size of a message that can be sent using the RTCDataChannel.send() method. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
| The state read-only property of the RTCSctpTransport interface provides information which describes a Stream Control Transmission Protocol (SCTP) transport state. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
| A statechange event is sent to an RTCSctpTransport to provide notification when the RTCSctpTransport.state property has changed. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
| The transport read-only property of the RTCSctpTransport interface returns a RTCDtlsTransport object representing the DTLS transport used for the transmission and receipt of data packets. | 76 | 79 | 113 | 15.4 | 76 | 15.4 |
Syntax
const peerConnection = new RTCPeerConnection();
const channel = peerConnection.createDataChannel("Mydata");
channel.onopen = (event) => {
channel.send("sending a message");
};
channel.onmessage = (event) => {
console.log(event.data);
};
// Determine the largest message size that can be sent
const sctp = peerConnection.sctp;
const maxMessageSize = sctp.maxMessageSize; Use cases
-
Using WebRTC SCTP information
The sctp read-only property of the RTCPeerConnection interface returns an RTCSctpTransport describing the SCTP transport over which SCTP data is being sent and received.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.