BridgeCodec
Defined in: packages/client/src/worker/protocol.ts:509
The codec every bridge payload crosses through (owner-mandated seam, ADR-0032 S2 §1). v1 ships exactly
ONE codec — identityCodec, which relies on the transport’s own structured clone. The seam exists
so a columnar/transferable codec (e.g. one that packs live-diff rows into a shared ArrayBuffer and
returns it as a transferable) can be swapped in later WITHOUT any protocol change: the router already
treats BridgeEnvelope.payload as opaque, and encode may return { payload, transfer } so the sender
hands transferables to postMessage. Keep encode/decode inverse and side-effect free.
Properties
Section titled “Properties”decode
Section titled “decode”decode: (
payload) =>unknown
Defined in: packages/client/src/worker/protocol.ts:513
Decode an envelope body back into the raw payload. Inverse of encode.
Parameters
Section titled “Parameters”payload
Section titled “payload”unknown
Returns
Section titled “Returns”unknown
encode
Section titled “encode”encode: (
payload) =>object
Defined in: packages/client/src/worker/protocol.ts:511
Encode a raw payload into the envelope body. May declare transferables for a future zero-copy codec.
Parameters
Section titled “Parameters”payload
Section titled “payload”unknown
Returns
Section titled “Returns”object
payload
Section titled “payload”payload:
unknown
transfer?
Section titled “transfer?”
optionaltransfer?:unknown[]