Connectivity
Peer-to-Peer Connectivity — Connecting devices directly
A practical introduction to peer-to-peer connectivity: how devices establish a direct connection across networks, the difference between signalling and relaying, the trade-offs involved, and where it fits.
Many conventional client-server applications exchange data through a central service. Two phones on a call, two devices syncing files — the data usually travels up to a company’s servers and back down again, even when the two devices are sitting next to each other. Peer-to-peer (P2P) connectivity is the alternative: the two endpoints connect and exchange data directly, with the central infrastructure kept to a minimum or out of the data path entirely. (P2P still often uses an intermediary for the introduction — discovery and signalling — as described below.)
The appeal is real — less central cost, lower latency, and data that need not pass through a third party. The catch is also real: getting two arbitrary devices on the internet to connect directly is genuinely hard, and it is not always possible.
What peer-to-peer means
In the familiar client-server model, devices talk to a central server, and the server relays or stores everything. In a peer-to-peer model, the devices (the “peers”) establish a connection between themselves and exchange data over it. Central infrastructure may still help them find each other, but the goal is for the actual content to flow directly between the endpoints.
The hard part: making a direct connection
If every device had a stable, globally reachable address, P2P would be simple. Most do not. Home and mobile devices sit behind NAT (Network Address Translation) and firewalls, with private addresses that the outside world cannot dial directly. Bridging that gap is the core of P2P connectivity.
- Discovery and signalling. Before two peers can connect, they have to find each other and exchange the information needed to set up the link (addresses, capabilities, keys). A small signalling (or rendezvous) service usually helps with this introduction. Crucially, this is a control role — helping peers meet — which is distinct from carrying their data.
- NAT traversal. With help from a signalling service, peers attempt to open a direct path through their NATs — a technique often called hole punching. Standard tools support this: STUN lets a device discover how it appears from the outside, and ICE systematically tries the possible connection paths to find one that works.
- Connection paths. A direct link may be established over the same LAN (both devices on one local network), over IPv6 (which gives globally routable addresses and often sidesteps NAT), or via NAT traversal across the internet.
- When direct fails. Some network combinations (certain strict NATs and firewalls) defeat direct connection. Here designs diverge: many systems fall back to a relay (e.g. TURN), where a server forwards the data — which restores connectivity at the cost of routing content through that server. Others deliberately do not relay payload, accepting that connectivity depends on a direct path being achievable.
Signalling versus relaying — the key distinction
These two roles are easy to conflate and important to separate:
- Signalling / discovery carries a small amount of control information to introduce peers. It is lightweight and does not see the content.
- Relaying forwards the actual payload between peers through a server. It carries everything.
A system can help peers connect (signalling) without ever carrying their content (relaying). That single design choice largely determines the privacy and cost profile of a peer-to-peer system.
Encryption
Direct does not mean secure. A direct connection can still be observed along its network path unless the data is encrypted. End-to-end encryption — where only the communicating devices hold the keys — is what actually protects the content, and it matters just as much in P2P as anywhere else.
Trade-offs and limitations
- It is not always possible. Some networks block direct connections; without a relay fallback, a connection may simply fail for certain peer pairs.
- Availability. A direct connection generally needs both peers reachable at the same time; there is no central server holding messages for a device that is offline unless the design adds one.
- No inherent central copy. Without a server in the middle, features people expect from central services — backup, history, moderation, multi-device sync — have to be designed in deliberately.
- Discovery still needs something. Peers must find each other somehow — a signalling service, a known address, or a local-network discovery mechanism.
- Key management. End-to-end encryption pushes responsibility for keys and identity onto the design; getting that right is essential and non-trivial.
Representative applications
- Real-time communication: voice, video and messaging directly between devices.
- File and data synchronisation: keeping devices in sync without a central copy.
- Collaboration and local-first apps: devices sharing state directly, working even on a local network with no internet.
- Device-to-device / IoT: equipment coordinating directly rather than via a hub.
These are examples, not a fixed list — wherever a direct link between endpoints is an advantage, P2P is worth considering.
Combining with other technologies
- With edge computing: P2P is endpoint-centric by design, so it pairs naturally with keeping processing and storage on the participating devices (see Edge Computing).
- With end-to-end encryption: the two together are what make direct communication both private and useful.
- With local-first data: devices holding their own data and syncing directly reduces dependence on a central service.
Example explored by Mansonix
The Mansonix peer-to-peer communication application (in development) is built around this model: privacy-oriented, direct device-to-device communication and synchronisation.
Its design follows the distinction above. Mansonix infrastructure —
rendezvous.mansonix.com — assists only with rendezvous, discovery and signalling;
user payload traffic is not relayed through Mansonix (there is no TURN-style relay).
Where a direct path can be established (same-LAN, IPv6 or NAT traversal), connections
are intended to carry user data directly between participating devices and use
end-to-end encryption. A consequence of not relaying payload, as described above, is
that connectivity depends on a direct path being achievable rather than falling back to
a Mansonix-hosted relay.
The way these roles fit together is shown as an architecture diagram on the Products page. That diagram is explanatory — it describes the intended design, not a measured or deployed result. No connectivity-rate, latency or scale figures are claimed; those would need real, reproducible measurement.
Sources & further reading
Peer-to-peer connectivity and NAT traversal are well documented in the research and standards literature:
- Ford, B., Srisuresh, P. & Kegel, D., “Peer-to-Peer Communication Across Network Address Translators,” USENIX Annual Technical Conference, 2005 — the foundational explanation of hole punching.
- IETF, RFC 8445: Interactive Connectivity Establishment (ICE) — the standard for finding a working connection path.
- IETF, RFC 8489 (STUN) and RFC 8656 (TURN) — discovering external addresses, and relaying when direct connection fails.
- W3C / IETF, WebRTC — a widely used framework for direct, encrypted peer connections.