Since May 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
A statechange event is sent to an RTCSctpTransport to provide notification when the RTCSctpTransport.state property has changed.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("statechange", (event) => { })
onstatechange = (event) => { }
A generic Event.
Given an RTCSctpTransport, transport, and an updateStatus() function that presents connection state information to the user, this code sets up an event handler to let the user know when the transport is connected.
pc.addEventListener(
"statechange",
(event) => {
switch (transport.state) {
case "connected":
updateStatus("Connection started");
break;
}
},
false,
);
Using onstatechange, it looks like this:
transport.onstatechange = (event) => {
switch (transport.state) {
case "connected":
updateStatus("Connection started");
break;
}
};
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
statechange_event |
76 | 79 | 113 | 63 | 15.4 | 76 | 113 | 54 | 15.4 | 12.0 | 76 | 15.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCSctpTransport/statechange_event