How Messages Travel: Peer-to-Peer vs Server-Based Messaging
When you press send, what actually happens? The route a message takes decides who could see it, who stores it and what happens when the other person is offline.
You type a message and press send. In a second, it appears on a friend's screen on the other side of the world. What happened in between is not magic, and the route the message took decides who could have seen it, who kept a copy and what happens when the other person is away. There are two main designs, and they differ more than most people realise.
The server-based route
In a typical messenger, your phone sends the message to the company's servers. The servers receive it, store it, find the recipient's phone and deliver it. If the recipient is offline, the server holds the message until they return. Everything passes through the middle.
This design is simple and reliable. It also means the company's servers are a central place where messages, or at least information about them, collect. Who talked to whom, when and how often is visible to the operator. If the messages are not end-to-end encrypted, the operator can read them. If they are, the operator can still see the pattern of who talks to whom.
The peer-to-peer route
In a peer-to-peer design, the two devices connect directly. A server introduces them, much as a mutual friend would at a party, and then steps back. The message travels from your device to your friend's device, with no copy left in the middle.
PeerFlow works this way for secure chat when both people are online. The connection between the devices is encrypted, and the message is end-to-end encrypted on top of that. The server never receives the message in this case, since it was never sent through it.
What if the other person is offline?
A direct connection needs both ends. If your friend's phone is off, the message cannot go directly. PeerFlow then sends the message to the server, encrypted, where it waits until your friend comes online. The server cannot read it. When it has been delivered, it is deleted from the server. So at most, an undelivered message sits on the server in encrypted form for a short time. Read the details in how offline messages work.
Comparing the routes
| Server-based | Peer-to-peer | |
|---|---|---|
| Message passes through a server | Always | Only when the recipient is offline |
| Server keeps messages | Often, for long | Briefly and encrypted, then deletes |
| Server sees who talks to whom | Yes | Sees introductions and waiting messages |
| Works when the other person is offline | Yes | Yes, through encrypted waiting |
| Delay | Depends on the data centre | Often lower |
| Content readable by the operator | Depends on encryption | No, end-to-end encrypted |
What the server still does
Even in a peer-to-peer design, a server has jobs. It helps devices find each other. It holds encrypted messages for people who are offline. It sends push notifications so your phone knows something has arrived. It manages accounts and contacts. The difference is that it does not need to see or keep your conversations.
Why this matters to you
- Smaller footprint. If few messages are stored on servers, fewer can leak or be requested.
- Faster delivery when both are online, because the route is shorter.
- Resilience. A direct connection between two devices does not depend on a busy central service for the message itself.
What peer-to-peer does not do
It does not make you invisible. The two devices learn network addresses from each other, as with any direct connection, and the server still knows that an introduction took place. Read is P2P safe? for an honest look at the trade-offs. It also does not remove the need for good habits, such as locking your phone.
Calls and files use the same idea
Voice calls, video calls, screen sharing and files follow the same pattern: a direct connection between devices, with a relay only when no direct path exists. Learn more about voice and video calls over peer-to-peer.
Try it
Install the Android or Windows app on two devices and send a message. Both online: it goes directly. Close one device, send another, then reopen it, and watch the message arrive.
Frequently asked questions
Do messages in PeerFlow always go directly between devices?
When both people are online, yes. If the other person is offline, the encrypted message waits on the server until it can be delivered and is then deleted.
Can the server read my messages?
No. Messages are end-to-end encrypted, so the server only sees encrypted data it cannot read.
Is peer-to-peer messaging slower?
No. A direct route is often faster, because the message does not have to go through a distant data centre.
What does the server do, then?
It introduces the two devices to each other, holds an encrypted message briefly when the recipient is offline, and sends alerts.