这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
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. |
候选推荐 | 最初的规范。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
datachannel
RTCDataChannel
RTCPeerConnection.ondatachannel
RTCPeerConnection
RTCDataChannelEvent
channel
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent