Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / fromPush

Function: fromPush() ​

fromPush<T>(connect, options?): Readable<T>

Defined in: projects/libraries/streamix/src/lib/factories/fromPush.ts:94

Adapts an externally pushed event source to a shared Streamix Readable.

Connection is lazy and shared among callback subscribers and one active async iterator. The source disconnects when the last consumer leaves. Reconnecting creates a new session; late events from an old session are ignored.

Subscribers receive the latest current value immediately when available. The async iterator receives new events (not a replay of the current snapshot).

next() resolves when the value is accepted into the bounded buffer, or when the overflow policy drops it. It does not wait for delivery, the current value update, or callback subscribers; those happen asynchronously in the pump. In discrete mode, awaiting next() applies backpressure only while the buffer is full. External APIs that ignore next() promises cannot be flow-controlled; select a dropping/error overflow policy for those APIs if memory must remain bounded.

This implementation intentionally supports one active async iterator, matching the existing Streamix shared-source contract. Callback subscribers multicast.

Type Parameters ​

T ​

T

Parameters ​

connect ​

Connect<T>

options? ​

FromPushOptions = {}

Returns ​

Readable<T>

Released under the MIT License.