Skip to content

Your app has a publishable key (pk_…) and a list of allowed origins. The key is meant to be in your page source. It identifies your app and is no secret, and the service also checks the page’s origin.

A room is a name you choose: [A-Za-z0-9_-], 1 to 64 characters. Rooms belong to your app: another app’s room with the same name is a different room. A room exists while someone is in it.

Anyone who knows your key and a room name can join that room (from an allowed origin), so use names that are hard to guess. See security and privacy.

A room of three peers, p1, p2 and p3, each linked directly to both others. Three peers: p1 (a laptop, marked as you), p2 (a phone) and p3 (a laptop). With three peers, every peer links to every other. ROOM · K3X9Q p1 · you p2 p3
Three peers in one room: with three, every peer links to every other.

The service gives each join() an integer id, unique in the room. A page reload or a new join() gets a new id. If your app has users, use join tickets: your server signs one for each user, and room.user(peerId) then gives every peer’s user id, vouched for by the service. Without tickets, map ids to users yourself: send room.id to your server after joining.

Each browser keeps direct links to a few others, about 6 (4 on phones), not to everyone, and messages are forwarded hop by hop. That keeps a 30-peer room cheap for every browser. See how messages travel.