WebRTC File Transfer — How It Works
WebRTC is the browser standard for real-time peer-to-peer communication. Tranzo uses its DataChannel API to stream files directly between browsers at full network speed.
What is WebRTC?
WebRTC (Web Real-Time Communication) is an open standard built into every modern browser. Originally designed for video calls, it includes a general-purpose DataChannel API that can transmit arbitrary binary data — including files — at high speed between peers.
Unlike HTTP uploads, WebRTC DataChannels are:
- Peer-to-peer — data flows directly between devices, not through a server
- Encrypted by default — DTLS 1.3 is mandatory in the WebRTC spec
- Low latency — no intermediary storage means no queuing delay
- Bi-directional — both ends can send simultaneously
WebRTC File Transfer vs HTTP Upload
| Feature | WebRTC (Tranzo) | HTTP Upload |
|---|---|---|
| Routing | Direct peer-to-peer | Via server |
| Sender bandwidth | Upload once | Upload once (to server) |
| Server stores file? | Never | Yes (until deleted) |
| Speed (same LAN) | 50–100 MB/s | Limited by server link |
| Encryption | DTLS E2E | TLS to server only |
| File size limit | None | Set by server config |
| Account required | No | Usually yes |
How the DataChannel Works in Tranzo
1. Signaling
Tranzo's Socket.IO server exchanges SDP (Session Description Protocol) offers and ICE candidates — the minimum metadata needed to establish a direct connection. No file data ever passes through this server.
2. ICE Negotiation and NAT Traversal
ICE (Interactive Connectivity Establishment) uses STUN servers to discover public IP addresses and a TURN relay as a last resort for strict firewalls. Once a viable path is found, the DataChannel opens.
3. Chunked Binary Transfer
The file is read in 64 KB chunks using the FileReader API. Each chunk is sent as an ArrayBuffer over the DataChannel. A Web Worker reassembles chunks on the receiver side without blocking the UI thread.
4. Backpressure Control
Tranzo monitors the DataChannel's bufferedAmount property and pauses chunk sending when the buffer fills. This prevents memory overflow on slow connections and ensures reliable delivery of very large files.
Browser Support
WebRTC DataChannels are supported in all modern browsers. Tranzo works on Chrome 80+, Firefox 75+, Edge 80+, and Safari 13+. No plugins or extensions are required.