RTCIceCandidate:tcpType 属性
>RTCIceCandidate 接口的 tcpType 只读属性是 TCP 候选者所包含的,表示候选者的额外类型信息。
tcpType 字段的值是从传递给 RTCIceCandidate() 构造函数的 candidateInfo 选项对象中设置的。你不能直接在选项对象中指定 tcpType 的值,如果对象的 candidate 属性行(a-line)格式正确,其值将自动从对象的候选属性行中提取。
值
如果 protocol 的值是 "tcp",tcpType 的值可以是:
UDP 候选者的 tcpType 值为 null。
示例
本例中,使用候选者的 protocol 和 tcpType 属性来判断 TCP 候选者用户端是否同时打开(simultaneous-open)。
js
if (candidate.protocol === "tcp" && candidate.tcpType === "so") {
adjustForSimultaneousOpen(candidate);
}
规范
| 规范 |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-rtcicecandidate-tcptype> |