# Peer-to-Peer

> The Peer-to-Peer (P2P) is an architecture where devices exchange data directly with each other instead of through a central server.

## What does peer-to-peer mean?

The architecture where devices connect and exchange data directly, without a central server relaying every message. Reduces latency and server costs, but connecting peers behind routers requires NAT traversal and does not scale well to large groups.

- Topic: Real-Time Communication
- Type: architecture

## Common mistakes

- Building a full mesh for large group calls, which overloads each device's upload.

## Key points

- Group calls with many participants use a media server instead of connecting every peer to every other peer.
- Data received from another peer is treated as untrusted input.

## Interview questions

### Is WebRTC peer-to-peer?

It tries to be: media flows directly between devices when possible, but signaling always uses a server and some calls fall back to a TURN relay.

### Is peer-to-peer more private?

Not automatically. Content can skip servers, but each peer learns the other's IP address unless traffic is relayed.

### Why doesn't peer-to-peer scale to large group calls?

In a mesh each device uploads its stream once per participant, so bandwidth and CPU grow with every new person.

## Related cards

- [WebRTC](https://wonderium.dev/web/webrtc.md)
- [SFU](https://wonderium.dev/web/sfu.md)
- [ICE](https://wonderium.dev/web/ice.md)

---

- Level: [Web Platform](https://wonderium.dev/web.md)
- HTML version: https://wonderium.dev/web/peer-to-peer
- Last updated: 2026-11-25
