Kit
Interfaces

RpcSubscriptionsChannel

A DataPublisher on which you can subscribe to events of type RpcSubscriptionChannelEvents<TInboundMessage>. Additionally, you can use this object to send messages of type TOutboundMessage back to the remote end by calling its `send(message)` method.

Extends

Type Parameters

Type Parameter
TOutboundMessage
TInboundMessage

Methods

on()

on<TChannelName>(channelName, subscriber, options?): UnsubscribeFn

Call this to subscribe to data over a named channel.

Type Parameters

Type Parameter
TChannelName extends keyof RpcSubscriptionChannelEvents<TInboundMessage>

Parameters

ParameterTypeDescription
channelNameTChannelNameThe name of the channel on which to subscribe for messages
subscriber(data) => voidThe function to call when a message becomes available
options?{ signal: AbortSignal; }-
options.signal?AbortSignalAn abort signal you can fire to unsubscribe

Returns

UnsubscribeFn

A function that you can call to unsubscribe

Inherited from

DataPublisher.on


send()

send(message): Promise<void>

Parameters

ParameterType
messageTOutboundMessage

Returns

Promise<void>

On this page