v151 · webrtc · data channel

Open-Latency Lab

Open a real data channel over a same-page RTCPeerConnection loopback and time createDataChannel → the channel's open event. That end-to-end interval includes signalling, ICE, DTLS, SCTP, and DCEP work; the SNAP proposal targets only the SCTP handshake portion.

Both peers live in this one page, so ICE resolves over host candidates with near-zero network delay. The absolute numbers are a local floor, not real-world latency. The timer is genuine but does not isolate SNAP or record whether each offer contains a=sctp-init; use it to inspect loopback variability, not to claim a SNAP speedup.

idle — press “Run latency test”
last open
median
min
max

how it works

Each run builds two RTCPeerConnections, opens a data channel on the offerer, and shuttles the offer, answer, and ICE candidates between them directly (no signalling server needed for loopback). We start a high-resolution timer at createDataChannel() and stop it in the channel's open event:

const t0 = performance.now();
const a = new RTCPeerConnection();
const b = new RTCPeerConnection();
a.onicecandidate = (e) => e.candidate && b.addIceCandidate(e.candidate);
b.onicecandidate = (e) => e.candidate && a.addIceCandidate(e.candidate);

const dc = a.createDataChannel("probe");   // requests a channel; several layers follow
dc.addEventListener("open", () => {
  const openMs = performance.now() - t0;    // end-to-end, not a SNAP-only delta
});

const offer = await a.createOffer();
await a.setLocalDescription(offer);
await b.setRemoteDescription(offer);
const answer = await b.createAnswer();
await b.setLocalDescription(answer);
await a.setRemoteDescription(answer);

The -00 draft’s classic-flow diagram places the four-message SCTP handshake after DTLS and reports up to two additional round trips. Its SNAP flow exchanges serialized INIT chunks through SDP and says the association should be considered established once DTLS finishes. This lab’s timer also contains signalling, ICE, DTLS, and DCEP costs, so comparing runs in one unflagged build cannot measure that proposed saving. A controlled enabled-versus-disabled network test would be required.

see also

references