← Lab

Visitors on the page at the same moment become pixels that see each other, play together on a shared clock and can exchange a few words that fade away. Browsers connect directly, nothing is recorded — when you leave, your trace is gone. A tiny accidental jam, and maybe one day a device for the Chaos Labs.

How it works, technically

Browsers talking directly

There is no TOPLAP server behind Ghosts. The browsers of the people on the page connect directly to each other, peer to peer, with WebRTC, the technology behind video calls in the browser. To find each other the first time they need a meeting point: the Trystero library uses public relays of the Nostr network for that. Each browser announces there that it enters the room fantomes (or fantomes-name for a private room, the name coming from the address after #), the others answer, then the direct connection is made and the relays are no longer used.

What travels

Only three messages: move, your position (two numbers between 0 and 1), sent at most every 50 ms; hi, your instrument; say, a word of at most 80 characters, one every 2 seconds, gone after 8 seconds. Nothing is recorded anywhere: when you close the page, you vanish. As with any direct connection, connected browsers know each other's IP address.

A shared clock with no conductor

Playing together needs the same tempo. Instead of sending a beat, each browser reads its own clock (Date.now()): computers are all set to world time to within a few milliseconds. The music is in eighth notes at 112 BPM, one step every 267.86 ms (60,000 / 112 / 2): the current step is Math.floor(Date.now() / 267.86), the same everywhere. Each note is then scheduled at the exact moment with the Web Audio API.

Sound and image

Your horizontal position picks the note, in a pentatonic scale over two octaves; the vertical position opens or closes a low-pass filter (300 to 3,800 Hz). The more you move, the louder and more often you play: a still ghost slowly fades, a restless one plays on every step. Each note is an oscillator (triangle, square, saw or sine) with an 8 ms attack and a 350 ms decay. On screen everything snaps to a 10 px pixel grid, like the logo; each ghost leaves a fading trail of 24 positions, and its colour is computed from its id.

Ethical questions: what does Ghosts depend on?

"Serverless" doesn't mean "nobody". Ghosts relies on services run by others. The site's host, GitHub Pages (Microsoft), receives the visits like any web page. Trystero's code (version 0.26.0) is served by the site itself, from /lab/vendor/: no code delivery service (CDN) is involved, and the code that runs is the one we reviewed and published. About thirty public Nostr relays, run by volunteers, act as the meeting point; a few of them are contacted on each visit. Some rate-limit or disappear, hence a sometimes slow connection. Finally, STUN servers from Google and Cloudflare help each browser learn its own public address, to open the direct connection.

There is no fallback server (TURN): on some very locked-down networks (companies, some mobile plans), two browsers may never manage to reach each other.

What data travels, and who sees it?

Nostr relays see your IP address (like any site you visit), the time, and the connection announcements. Those announcements are encrypted (AES-GCM), but with a key derived from the app and room names, which are written in the public code: it protects against casual reading, it isn't a secret. They contain what's needed to connect, including IP addresses.

STUN servers see your IP address. The other ghosts receive your position, your instrument, your words, and your IP address, since the connection is direct. What travels between browsers is encrypted by WebRTC (DTLS).

Nobody receives a name, an account, a cookie, or your microphone or camera: Ghosts never asks for them. The site has no audience tracking, and TOPLAP Strasbourg records nothing. For more discretion: a private room limits who you meet, and a VPN hides your IP address from the others.

What about moderation?

Words show up for everyone, unfiltered and unarchived: there is nobody to moderate, and nothing to report afterwards. That's the other side of having no server. The only limits are technical: 80 characters, one message every 2 seconds, erased after 8 seconds. For a workshop or a group, a private room is better.

What does it cost?

For TOPLAP Strasbourg: nothing. Hosting is free and the relays' work is offered by others. It's a kind of commons, which can vanish if those volunteers stop. The energy used is mostly your own devices': a few dozen small messages per second, a synthesised sound and a drawing redrawn every frame. The alternative would be a small server of our own, for a few euros a month: more control, moderation possible, but a machine to maintain and data passing through us.

The code is free: fantomes.js, one page of JavaScript. Take it for your own rooms.