v148 · WebRTC · DataChannel

File Transfer Demo

P2P file transfer over a loopback RTCPeerConnection using alwaysNegotiateDataChannels: true. The toggle compares the Chrome 148 late-channel flow against the timing-sensitive default flow.

Checking RTCPeerConnection support…
⚠ alwaysNegotiateDataChannels disabled — this run creates the data channel after offer/answer, so the default flow needs renegotiation before it can open.

Peer A — Sender

disconnected
Click or drop file here to send

Peer B — Receiver

waiting
Received files will appear here

Connection log

Click "Connect" to establish a loopback RTCPeerConnection…

alwaysNegotiateDataChannels

// Chrome 148: alwaysNegotiateDataChannels option
const pc = new RTCPeerConnection({
  alwaysNegotiateDataChannels: true,
});

// Now it's safe to create a DataChannel immediately,
// even before the remote peer has added one.
// The SDP offer/answer will always include data channel negotiation.
const channel = pc.createDataChannel('files');
channel.onopen = () => console.log('channel open — no race');

// Without the flag (pre-148), creating a channel before offer/answer
// could fail silently if the remote didn't expect one.

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗