Specによると、
An RTCDataChannel can be configured to operate in different reliability modes.
A reliable channel ensures that the data is delivered at the other peer through retransmissions.
An unreliable channel is configured to either limit the number of retransmissions ( maxRetransmits ) or set a time during which transmissions (including retransmissions) are allowed ( maxPacketLifeTime ).These properties can not be used simultaneously and an attempt to do so will result in an error.
Not setting any of these properties results in a reliable channel.
というわけで、何も指定してない場合は、`reliable`モードになってる。
オプションを渡すだけ
const pc = new RTCPeerConnection(); // このどっちかが指定されてれば、`unreliable`になる pc.createDataChannel('unreliable-dc', { maxRetransmits: 10, maxPacketLifeTime: 10, });
どうやって確認するか
const pc = new RTCPeerConnection(); const dc = pc.createDataChannel('unreliable-dc', { maxRetransmits: 10, }); dc.reliable; // false
ただしこの`reliable`はSpecにも載ってないので、ご利用は計画的に・・。
少なくともSafariには生えてなかったので、その場合はどうやって確認すればいいんやろね?