A single expose() call can be reached by more than one peer — several pages connecting to one SharedWorker, several contexts on one broadcast channel. osra connects them all, but the returned promise only ever carries one value.
The promise returned by expose() resolves with the first peer’s value. Later peers still connect, can call your exposed value, and keep their own connection state, but there is no public accessor for their values.
var SharedWorker:new (scriptURL:string|URL, options?:string|WorkerOptions) =>SharedWorker
The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers.
The page passes the SharedWorker object itself; osra sends and listens on its .port (and starts it) internally. The worker side gets one expose() — and one first-wins promise — per connecting page, so each connection is isolated and each page’s value is addressable.
To connect two peers that share no direct channel — two workers, or an iframe and a worker — a context that owns both transports can forward envelopes between them with relay().