v159 · webtransport · practical

Worker error relay

A common architecture keeps the WebTransport session in a Worker so parsing and back-pressure never block the UI. When the session fails, the page needs to know why: was it the session or a single stream, and which application code did the peer send? With [Serializable] in Chrome 159, the worker can simply postMessage(error) and the page receives a real WebTransportError with source and streamErrorCode intact.

Serialization ships enabled in Chrome 159 behind a writer-side runtime switch, WebTransportErrorSerialization; if your build has it off, relaunch with --enable-blink-features=WebTransportErrorSerialization (or turn on chrome://flags/#enable-experimental-web-platform-features in a developer-trial build). Without it, postMessage throws DataCloneError in the sender; this page then shows the plain-record fallback the worker sends instead, labelled as a fallback. The failing session is real: it targets https://127.0.0.1:44443/never, which nothing answers, so Chrome itself logs a “Failed to establish a connection” console error each time — that line is expected.

Worker → page

delivered as
nothing yet
constructor
—
instanceof WebTransportError
—
message
—
source
—
streamErrorCode
—

Not run yet.

Page → worker

The other direction matters too: the UI may decide to abort a stream and hand the reason to the worker that owns the writer. This builds the error in the page (standard constructor, falling back to the legacy one) and posts it; the worker reports what arrived in its realm.

Not run yet.

Message log

    see also