Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

RTCDataChannel: closing event

Limited availability

Theclosing event is sent to anRTCDataChannel just before the channel begins the process of shutting down its underlying data transport.

This event is not cancelable and does not bubble.

Syntax

Use the event name in methods likeaddEventListener(), or set an event handler property.

js
addEventListener("closing", (event) => { })onclosing = (event) => { }

Event type

A genericEvent.

Description

While theclosing event is sent to the channel just before beginning to close the channel's data transport, theclose event is sent once the closing process is complete.

Examples

This example updates a connection status interface when theclosing event arrives.

First, an example usingaddEventListener():

js
dataChannel.addEventListener("closing", (ev) => {  myConnectionStatus.icon = closingIcon;  myConnectionStatus.text = "Connection closing";});

You can also set theonclosing event handler property directly:

js
pc.onclosing = (ev) => {  myConnectionStatus.icon = closingIcon;  myConnectionStatus.text = "Connection closing";};

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# event-datachannel-closing
WebRTC: Real-Time Communication in Browsers
# dom-rtcdatachannel-onclosing

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp