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()
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
send()
Parameters
| Parameter | Type |
|---|---|
message | TOutboundMessage |
Returns
Promise<void>