closing event is sent to an RTCDataChannel just before the channel begins the process of shutting down its underlying data transport.

冒泡 No
可取消 No
接口 事件
事件处理程序特性 RTCDataChannel.onclosing

描述

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.

范例

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";
};
					

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannel: closing event' in that specification.
候选推荐

浏览器兼容性

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 兼容性数据存储库 .

另请参阅

元数据

  • 最后修改: