Skip to content

Documentation / @eventkit/http / eventSourceObservable

Function: eventSourceObservable()

Call Signature

ts
function eventSourceObservable<T>(source, opts): AsyncObservable<EventSourceEvent<T>>

Creates an AsyncObservable from an EventSource instance.

Type Parameters

Type ParameterDescription
TThe type of data contained in message events

Parameters

ParameterTypeDescription
sourceEventSourceThe EventSource instance to convert to an AsyncObservable
opts{ dematerialize: true; }Configuration options for the observable
opts.dematerializetrueWhen true, yields full event objects including metadata. When false or omitted, yields only the message data.

Returns

AsyncObservable<EventSourceEvent<T>>

An AsyncObservable that yields either raw message data or full event objects

Call Signature

ts
function eventSourceObservable<T>(source, opts?): AsyncObservable<T>

Creates an AsyncObservable from an EventSource instance.

Type Parameters

Type ParameterDescription
TThe type of data contained in message events

Parameters

ParameterTypeDescription
sourceEventSourceThe EventSource instance to convert to an AsyncObservable
opts?{ dematerialize: false; }Configuration options for the observable
opts.dematerialize?falseWhen true, yields full event objects including metadata. When false or omitted, yields only the message data.

Returns

AsyncObservable<T>

An AsyncObservable that yields either raw message data or full event objects

Released under the MIT License.