Creates event source from url (and config) and returns an observable with parsed event source data. Opens the event source once subscribed. Closes the event source, once unsubscribed.
const options = { // ...};const sse$ = eventSource$( 'https://example.com/sse', { withCredentials: false }, // or true options);sse$.subscribe((data) => { console.log(data);});
Takes EventSource and creates an observable from it.
const sse = new EventSource(url, configuration);const options = { // ...};return fromEventSource(sse, options).pipe( finalize(() => { // Make sure the EventSource is closed once not needed. sse.close(); }),);
Generated using TypeDoc
Creates event source from url (and config) and returns an observable with parsed event source data. Opens the event source once subscribed. Closes the event source, once unsubscribed.