The closing event is sent to an RTCDataChannel just before the channel begins the process of shutting down its underlying data transport.
| Bubbles | No |
| Cancelable | No |
| Interface | Event
|
| Event handler property | RTCDataChannel.onclosing
|
Description
While the closing event is sent to the channel just before beginning to close the channel's data transport, the close event is sent once the closing process is complete.
Examples
This example updates a connection status interface when the closing event arrives.
First, an example using addEventListener():
dataChannel.addEventListener("closing", ev => {
myConnectionStatus.icon = closingIcon;
myConnectionStatus.text = "Connection closing";
});
You can also set the onclosing event handler property directly:
pc.onclosing = ev => {
myConnectionStatus.icon = closingIcon;
myConnectionStatus.text = "Connection closing";
};
Specifications
| Specification | Status | Comment |
| WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDataChannel: closing event' in that specification. | Candidate Recommendation |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "api.RTCDataChannel.closing_event" (depth: 1) to the MDN compatibility data repository.
See also
RTCDataChannel: closing event by Mozilla Contributors is licensed under CC-BY-SA 2.5.