Skip to content

mapTransport

function mapTransport<A, B>(
inner,
encode,
decode): Transport<B>;

Defined in: transport.ts:23

Adapt a Transport<A> into a Transport<B> through a codec. Use it to wrap, namespace, version, compress, or otherwise reshape messages without rewriting the underlying wire — e.g. multiplex several features over one socket by tagging messages, or persist a different shape than you transmit.

Type Parameter
A
B
ParameterType
innerTransport<A>
encode(message) => A
decode(message) => B

Transport<B>