Kit
Functions

transformChannelInboundMessages

transformChannelInboundMessages<TOutboundMessage, TNewInboundMessage, TInboundMessage>(channel, transform): RpcSubscriptionsChannel<TOutboundMessage, TNewInboundMessage>

Given a channel with inbound messages of type T and a function of type T => U, returns a new channel with inbound messages of type U.

Note that this only affects messages of type "message" and thus, does not affect incoming error messages.

Type Parameters

Type Parameter
TOutboundMessage
TNewInboundMessage
TInboundMessage

Parameters

ParameterType
channelRpcSubscriptionsChannel<TOutboundMessage, TInboundMessage>
transform(message) => TNewInboundMessage

Returns

RpcSubscriptionsChannel<TOutboundMessage, TNewInboundMessage>

Example

const transformedChannel = transformChannelInboundMessages(channel, JSON.parse);

On this page