ReactiveStreamSource

type ReactiveStreamSource<T> = object;

Duck-type for objects that build a ReactiveStreamStore on demand via reactiveStore(). Satisfied by PendingRpcSubscriptionsRequest<T>. Reactive-framework bindings (e.g. React's useSubscription) consume this duck-type so they don't have to name a concrete producer type.

perConnectionSignal is a factory invoked on each connection (initial subscribe + every retry). The returned signal composes with the connection's internal controller via AbortSignal.any, so aborting it tears down just that connection — naturally expressing per-attempt timeouts, or a permanent kill switch when the factory returns the same cancellable signal on every call.

Example

function bindWithTimeout<T>(source: ReactiveStreamSource<T>) {
    return source.reactiveStore({ perConnectionSignal: () => AbortSignal.timeout(30_000) });
}

See

Type Parameters

Type ParameterDescription
TThe value type emitted by the resulting stream store.

Methods

reactiveStore()

reactiveStore(options): ReactiveStreamStore<T>;

Parameters

ParameterType
options| { abortSignal: AbortSignal; perConnectionSignal?: () => AbortSignal; } | { abortSignal?: AbortSignal; perConnectionSignal: () => AbortSignal; }

Returns

ReactiveStreamStore<T>

On this page