Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. RTCDataChannelEvent
  4. channel

RTCDataChannelEvent: channel property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨January 2020⁩.

The read-only propertyRTCDataChannelEvent.channelreturns theRTCDataChannel associated with the event.

Value

ARTCDataChannel object representing the data channel linking thereceivingRTCPeerConnection to its remote peer.

Example

The first line of code in thedatachannel event handler shown below takesthe channel from the event object and saves it locally for use by the code handling datatraffic.

js
pc.ondatachannel = (event) => {  inboundDataChannel = event.channel;  inboundDataChannel.onmessage = handleIncomingMessage;  inboundDataChannel.onopen = handleChannelOpen;  inboundDataChannel.onclose = handleChannelClose;};

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# dom-datachannelevent-channel

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp