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
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
channel | Chrome Full support Yes | Edge Full support ≤79 | Firefox Full support 22 | IE No support No | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support 28 | Firefox Android Full support 22 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.5 |
Legend
- Full support
- Full support
- No support
- No support