WebRTC Connectivity

SCTP Message Size and Interleaving Across DataChannels

Understand max-message-size, SCTP fragmentation, message interleaving, and head-of-line blocking to choose safe chunks across browsers and high-latency TURN paths.

A capability stays maintainable only when the team can explain every state, retry, and piece of residual data—not merely show one successful run. One send may be fragmented by SCTP, yet endpoints still negotiate maximum message sizes. Without interleaving, one large low-priority message can monopolize the association and delay control on other channels.

WebRTC decisions need evidence from both endpoints, negotiation versions, and the selected candidate pair. One browser callback cannot reveal glare, ICE route changes, or divergence after a peer refresh.

Questions the design must answer

Turn the important choices into durable contracts: validate inputs, assign state ownership, define cleanup, and specify fallback for older peers. Later optimization must not change those semantics.

  • Read the negotiated remote limit and choose the smaller of it and the application safety cap.
  • Keep chunks conservatively sized and raise throughput with a flight window rather than giant messages.
  • Keep control messages small and high priority, with a fallback for implementations lacking interleaving.

Safe chunking balances throughput, memory, and control latency below the negotiated ceiling. Window scheduling usually beats increasing one message.

Edge cases are part of the feature

An abnormal path is more than an error banner. It decides how in-flight work stops, how the peer learns the outcome, what residue remains, and whether the next operation inherits it.

  • A fixed 128 KB send exceeds a peer’s 64 KB negotiated limit and throws.
  • Chunk size grows because bufferedAmount is low while association-level head-of-line blocking is ignored.
  • Direct tests pass, but TURN/TCP latency and retransmission amplify control delay.

Prove that it works with evidence

Do not stop verification when the final action succeeds. Count side effects, measure wait time, inspect privacy, and prove the next run begins from a clean baseline.

  1. Use several max-message-size SDP fixtures and prove the chunker never exceeds the peer limit.
  2. Measure p95 cancel, heartbeat, and chat latency during bulk transfer, not file throughput alone.
  3. Test high-loss TURN/TCP across browser pairs with and without message interleaving.

The release bar is clear: users understand the current state, failures stop or recover, resources stay bounded, and operators can identify the phase from minimum necessary evidence.

Put the guide to work

Open uCopy and connect two devices securely from the browser.

Start for free