Port Authority

Six moves with a port

Everything else on this site is built from these. Each box below is a real browsing context on its own origin, the cables appear when a port actually lands, and the dots are real messages. Press the buttons.

Further out

What a port can carry, and where it can end up. These lean on newer parts of the platform, so some will say no in some browsers.

Across threads

A port is not tied to a page. It can live in a worker, and what travels over it can be video, or the use of a key. These are about what that makes possible.

Between real sites

Most boxes on this page are sandboxes with no origin of their own. In this part the outer boxes are the florist's and the library's actual sites, embedded here, each with its own address and its own storage. These are about what you hand over, and whether you can get it back.

Further than this page

The other end of a port can be on another device, behind a path on your own site, in a worker that every tab shares, or on the thread that makes sound. The code that holds the port is the same each time.

Block on a port: a synchronous call with no await

Ports are asynchronous, and a great deal of old code is not. Add a few bytes of shared memory and a worker can ask a question down a port and stop dead on that line until the answer is written, even when the answer is a person pressing a button. Shared memory needs a cross-origin isolated page, so this one has a room of its own.

Open the isolated room

What will go down a port in your browser

Nothing here is looked up. When you scroll to this table, each kind of object is made, then really sent to a worker, really sent to a frame on another origin, and really written to IndexedDB. The answers are your browser's.

KindTo a workerTo another originInto IndexedDB
Waiting until you scroll here.

The last column is why a port cannot outlive its page on its own: anything that must be moved cannot be stored. Things that are copied can.

Things that will bite you