Skip to content

Each browser keeps direct links to a few others, about 6 (4 on phones), not to everyone. A message to a peer you are not linked to is forwarded hop by hop through other browsers in the room. That keeps a 30-peer room cheap for every browser, and it means a message to one peer may pass through other peers’ browsers.

A room of eleven peers, laptops and phones, each linked directly to two to six others. The introducer sits outside the room. One link, between p7 and p9, goes through the relay outside the room, which sees only ciphertext. A message is on its way from p11 to p7. Peers p1 to p11 in one room, p7 marked as you. Each has a few direct links, none links to everyone. The introducer, outside the room, is idle. The relay, outside the room, carries the one link between p7 and p9. A message travels on the link from p11 to p7. ROOM · K3X9Q introducernot in the data path relayciphertext only p1 p2 p3 p4 p5 p6 p7 · you p8 p9 p10 p11
A room of eleven peers: each is linked directly to a few others, and one link goes through the relay.

Messages sent with send and sendReliable are sealed: the browsers in between cannot read or alter them. broadcast is signed by its sender, so it cannot be forged, but it is not sealed; see security and privacy.

When two browsers cannot connect directly (strict NATs, some corporate networks), their link goes through jsflow’s relay (TURN). This needs nothing from you: credentials come with each join. On networks that block UDP the relay falls back to TCP and TLS on port 443.

Two peers, p7 and p9, whose direct link is blocked by their networks. Their link goes through the relay, outside the room, which passes on ciphertext it cannot read. p7 (you) and p9 are in the room with p3 and p8, which link to them directly. Between p7 and p9 the direct link is blocked (a cross). A dashed link runs from p7 down to the relay, outside the room, and back up to p9. The relay sees only ciphertext. ROOM · K3X9Q no direct link relayciphertext only p7 · you p9 p3 p8
When two peers cannot link directly, their link goes through the relay, which sees only ciphertext.

Relayed traffic is the part of jsflow that costs bandwidth, so it is metered separately from peer-minutes. Whether links in your rooms are direct or relayed is visible in the dashboard.

You can send everything through the relay on purpose, so that peers never see each other’s IP addresses: join with iceTransportPolicy: 'relay'. See security and privacy.

Key to jsflow diagrams: laptop, phone and dot peers; an away peer; direct, relayed and introducer lines; the room boundary; a message in flight, a sealed message and a route. Peers: a laptop, a phone, a dot for small sizes, each in its peer colour with its id; an away peer drawn hollow and grey with no links; a gone peer is not drawn. Lines: direct (solid), relayed (dashed, through the relay), the introducer's touch (dotted, only during a join), the room boundary (dash-dot). Live: a message in flight in the lamp colour, a sealed message with a lock, and a route in ink with arrows and hop numbers. PEERS p1 laptop p2 phone p3 dot, small sizes p4 · away away: hollow, no links p5 · gone: not drawn LINKS AND SERVICES direct relayed introducer, carries no data room LIVE AND ROUTED message in flight sealed (send) route, hop no.
The key to the diagrams: peers, direct and relayed links, the introducer, and a message in flight.