RTCDataChannelEvent.channel

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The read-only property RTCDataChannelEvent.channel returns the RTCDataChannel associated with the event.

Syntax

 var channel = RTCDataChannelEvent.channel;

Value

A RTCDataChannel object representing the data channel linking the receiving RTCPeerConnection to its remote peer.

Example

The first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic.

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

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannelEvent.channel' in that specification.
Candidate Recommendation Initial specification.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ?22 No Yes ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes28 ?22 Yes ? Yes

See also

Document Tags and Contributors

Contributors to this page: fscholz, Sheppy, teoli
Last updated by: fscholz,