How Random Chat Matchmaking Actually Works
What happens between tapping the button and hearing a voice: queues, filters, WebRTC signalling, and why "random" is never quite random.
Tapping a button and hearing a stranger's voice two seconds later looks simple, and the fact that it looks simple is most of the engineering. Here is what actually happens in those two seconds, and why some of the design decisions are less obvious than they seem.
Step one: you join a queue
The core data structure of every random chat platform is a waiting queue. When you tap, your connection is added to it. The matchmaker looks for another waiting connection that is compatible with yours, and when it finds one it removes both and pairs them.
Naively that is: take the two people who have been waiting longest, pair them, done. That is genuinely how the simplest version works and it is remarkably effective, because at any real scale there is almost always someone waiting.
Step two: filters make it harder than it looks
Filters break the simple version. If you want to match with a specific country, the matchmaker can no longer take the first two in line - it has to search for someone who matches your preferences and whose own preferences you satisfy. Preferences are mutual, which means the constraint is bidirectional and the search is not free.
The real difficulty is what to do when nothing matches. Waiting forever gives you a perfect match and an empty screen; matching immediately ignores the filter you set. Most platforms relax constraints over time - try the exact match briefly, then widen. That trade is why a heavily filtered search takes longer, and why the honest answer to "why did I get matched with the wrong country" is usually "because you would otherwise still be waiting".
Step three: signalling
Once two people are paired, they have to establish a direct audio connection, and neither knows the other exists. Bridging that is called signalling: the server relays a small number of messages between the two browsers - an offer, an answer, and a set of candidate network addresses.
The important detail is that signalling is all the server does for the call. It introduces the two browsers and then steps out. The messages it relays describe how to connect, not what is said.
Step four: NAT traversal, the genuinely hard part
Two browsers cannot simply connect to each other, because almost nobody has a directly reachable address. You are behind a home router, a mobile carrier's network, an office firewall - layers of address translation that are excellent at letting you reach a server and terrible at letting anyone reach you.
The workaround is a STUN server: a machine on the public internet whose only job is to answer "what address did this request appear to come from?". Both browsers ask, exchange the answers through the signalling channel, and attempt to connect directly to each other. This works for the large majority of connections.
When it fails - symmetric NAT, strict corporate firewalls - the fallback is a TURN server that relays the audio. That works but costs real bandwidth, which is why free platforms often skip it and why a small percentage of calls on any WebRTC service simply fail to connect.
Step five: the audio itself
Once the direct path is established, audio flows browser to browser, encrypted, without passing through the platform's servers. This is not a privacy feature bolted on afterwards - it is how WebRTC works by default, and it has the pleasant consequence that the operator is not in a position to record the call even if asked.
It is also why voice-only platforms can be cheap to run at scale. Server bandwidth is roughly independent of how long calls last, because the calls are not on the server. Video works the same way but at ten to thirty times the bitrate, which is where a lot of the economics of the category comes from.
Why "random" is never quite random
True uniform randomness across all users is neither achievable nor desirable. Achievable fails because you can only match people who are online at the same moment, which means the pool is shaped by timezone before any algorithm runs - the "random" stranger you meet at 3am in London is far more likely to be in Karachi than in Chicago, and no code chose that.
Desirable fails because filters, bans and abuse prevention all deliberately bias the draw. Anyone banned is excluded. Anyone whose filters exclude you is excluded. What is left is random within a pool that has already been shaped several times, which is the honest description of every platform in this category.
Where moderation fits
Moderation cannot inspect call content on a peer-to-peer platform, because the content never reaches the server. What it can do is act on reports: a report identifies a pairing the server already knows about, and repeated reports against the same device or address produce a ban enforced at connection time - before matching, which is the only place enforcement can happen.
That is why the abuse profile of a voice platform differs so sharply from a video one. There is no content scanning either way; the difference is that removing the camera removes the abuse pattern that content scanning was needed for.
Try it
All of the above happens in about two seconds and none of it is visible. Tap once and the only thing you notice is that someone says hello.