PendingRpcSubscriptionsRequest
Pending subscriptions are the result of calling a supported method on a RpcSubscriptions object. They encapsulate all of the information necessary to make the subscription without actually making it.
Calling the `subscribe(options)` method on a
PendingRpcSubscriptionsRequest<TNotification> will
trigger the subscription and return a promise for an async iterable that vends TNotifications.
Calling the `reactiveStore()` method
will return a ReactiveStreamStore compatible with useSyncExternalStore, Svelte
stores, and other reactive primitives. The returned store is in status: 'idle'; the caller
is responsible for invoking ReactiveStreamStore.connect | `connect()` to open the
underlying stream. Attach a caller-provided cancellation source via
ReactiveStreamStore.withSignal | `withSignal()`.
Type Parameters
| Type Parameter |
|---|
TNotification |
Methods
reactiveStore()
Synchronously returns a ReactiveStreamStore that holds the latest notification.
Compatible with useSyncExternalStore and other reactive primitives that expect a
{ subscribe, getUnifiedState } contract. The returned store is in status: 'idle' — call
ReactiveStreamStore.connect | `connect()` to open the subscription; a follow-up
connect() after an error reopens it. Attach a caller-provided cancellation source via
ReactiveStreamStore.withSignal | `withSignal()`.
Returns
ReactiveStreamStore<TNotification>
Example
subscribe()
Triggers the subscription and returns a promise for an async iterable of notifications.
Use for await...of to consume notifications as they arrive. Abort the signal to
unsubscribe.
Parameters
| Parameter | Type |
|---|---|
options | RpcSubscribeOptions |
Returns
Promise<AsyncIterable<TNotification, any, any>>