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.
var channel = RTCDataChannelEvent.channel;
A RTCDataChannel
object representing the data channel linking the receiving RTCPeerConnection
to its remote peer.
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; }
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCDataChannelEvent.channel' in that specification. | Candidate Recommendation | Initial specification. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | ? | 22 | No | Yes | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | 28 | ? | 22 | Yes | ? | Yes |
datachannel
RTCDataChannel
RTCPeerConnection.ondatachannel
RTCPeerConnection
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannelEvent/channel