← Lessons

quiz vs the machine

Platinum1810

Networking

WebRTC Data Channels

How browsers open peer to peer data links with configurable reliability.

6 min read · advanced · beat Platinum to climb

Direct Browser To Browser Data

WebRTC is best known for audio and video, but it also offers data channels that carry arbitrary bytes directly between two browsers, without routing every message through a server.

Getting Connected

Peers cannot simply find each other behind home routers, so WebRTC uses a setup dance.

  • A signaling server, chosen by the app, exchanges connection descriptions.
  • ICE gathers candidate addresses to try.
  • STUN discovers a peer public address behind a router.
  • TURN relays traffic when a direct path is impossible.

Once candidates connect, the peers talk directly when they can.

The Transport Underneath

A data channel runs over SCTP carried inside a secure DTLS session. SCTP brings useful flexibility that plain TCP lacks.

  • A channel can be reliable and ordered like TCP.
  • It can be unreliable and unordered for low latency game state.
  • Limits on retransmits or time let an app tune the trade off per channel.

Why It Matters

This lets games, file transfer, and collaborative tools move data peer to peer with chosen reliability, cutting server cost and latency.

Key idea

WebRTC data channels carry bytes peer to peer over SCTP inside DTLS, set up through signaling and ICE, with per channel reliability that ranges from ordered to fast and lossy.

Check yourself

Answer to earn rating on the learn ladder.

1. What transport carries a WebRTC data channel?

2. What is the role of a TURN server?

3. Why can a data channel be unreliable and unordered?