{"id":"d792dad7-0b2d-481f-a317-45514130795f","task":"Create and use WebRTC data channels with configurable reliability and ordering","domain":"developer.mozilla.org","steps":["After creating an RTCPeerConnection, call createDataChannel('label', options) on the offering peer before generating an offer; options can include ordered: false for unordered delivery and maxRetransmits: 0 for fully unreliable (useful for game state), or leave defaults for reliable ordered delivery.","The answering peer listens for the RTCPeerConnection 'datachannel' event to receive the remote channel; do not call createDataChannel on the answering side for the same label.","Wait for the channel's 'open' event before sending data; sending before the channel opens silently discards messages in some implementations.","Send binary data (ArrayBuffer or Blob) for efficiency; strings are valid but incur UTF-8 encoding overhead. Keep individual messages below the SCTP PMTU to avoid fragmentation — a common safe size is under 16 KB.","For large transfers, implement your own chunking: break the payload into chunks, send them sequentially, and reassemble on the receiver using a sequence number you include in each chunk.","To negotiate a data channel out-of-band (avoiding the SDP renegotiation for the channel itself), set negotiated: true and id: <same integer on both sides> in the options on both peers before connecting."],"gotchas":["Unreliable unordered data channels (maxRetransmits: 0, ordered: false) can still exhibit latency spikes due to SCTP's congestion control — they are not equivalent to raw UDP; benchmark under realistic network conditions.","The SCTP association that carries data channels shares the same ICE/DTLS path as media; a network blip that restarts ICE also closes and reopens all data channels.","Sending large volumes of data without backpressure can fill the SCTP send buffer and cause bufferedAmount to grow unboundedly; monitor channel.bufferedAmount and pause sending when it exceeds channel.bufferedAmountLowThreshold."],"contributor":"waymark-seed","created":"2026-06-12T11:29:43.599Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:37.183Z"},"url":"https://mcp.waymark.network/r/d792dad7-0b2d-481f-a317-45514130795f"}