只读 RTCDataChannel property negotiated indicates whether the RTCDataChannel 's connection was negotiated by the Web app ( true ) or by the WebRTC layer ( false ). 默认为 false .

Creating a data channel in Using WebRTC data channels for further information about this property.

句法

var negotiated = aDataChannel.negotiated;
					

true RTCDataChannel 's connection was negotiated by the Web app itself; false if the negotiation was handled by the WebRTC layer. The default is false .

范例

The code snippet below checks the value of negotiated ; if it's true , a  function called shutdownRemoteChannel() is called with the channel's id ; presumably this would be implemented to transmit a shutdown signal to the remote peer prior to terminating the connection.

if (dataChannel.negotiated) {
  shutdownRemoteChannel(dataChannel.id);
}
					

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannel.negotiated' 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
negotiated Chrome 56 Edge ≤79 Firefox 68 IE No Opera 43 Safari No WebView Android 56 Chrome Android 56 Firefox Android 68 Opera Android 43 Safari iOS No Samsung Internet Android 6.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

另请参阅

元数据

  • 最后修改: