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
DataPublisher
<RpcSubscriptionChannelEvents
<TInboundMessage
>>
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
Parameter | Type | Description |
---|---|---|
channelName | TChannelName | The name of the channel on which to subscribe for messages |
subscriber | (data ) => void | The function to call when a message becomes available |
options? | { signal : AbortSignal ; } | - |
options.signal? | AbortSignal | An 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
Parameter | Type |
---|---|
message | TOutboundMessage |
Returns
Promise
<void
>