这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

The read-only property RTCDataChannelEvent .channel 返回 RTCDataChannel 与事件关联。

句法

 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;
}
					

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannelEvent.channel' in that specification.
候选推荐 最初的规范。

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
channel Chrome Yes Edge ≤79 Firefox 22 IE No Opera Yes Safari Yes WebView Android Yes Chrome Android 28 Firefox Android 22 Opera Android Yes Safari iOS Yes Samsung Internet Android 1.5

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: