webrtc 数据通道 sctp 详细信息

webrtc datachannel sctp details

连接 webrtc 数据通道后,我想获取有关连接的详细信息。 (我承认我对冰和重新谈判仍然很模糊)。

在我的 datachannel.onopen 中,我尝试获取 sctp

var sctp = myPeerConnection.sctp;

但它返回未定义。它只是尚未在 Chrome 和 Firefox 中实现吗?我如何才能看到实际使用的传输方式,因为 localDescription 和 remoteDescription 都有所有冰候选项,但没有最终选择的传输方式。

来自文档:https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/sctp

The read-only sctp property on the RTCPeerConnection interface returns an RTCSctpTransport describing the SCTP transport over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null.

看来您的数据通道没有使用 SCTP。 如果您使用的是 Chrome,您可以使用此地址获得有关 webrtc 会话的更多详细信息:chrome://webrtc-internals/

编辑:返回 undefined 与 null 不同,对错误感到抱歉。文档说 Chrome 和 Firefox 不(还?)支持此功能...

要查看有关数据通道会话的更多信息,您还可以使用 wireshark。