Documentation / @eventkit/http
@eventkit/http
is a package that provides HTTP utilities for eventkit.
Installation
sh
npm i @eventkit/http
Related Resources
Classes
Class | Description |
---|---|
EventSource | A drop-in replacement for the standard EventSource class that provides an Observable interface for handling Server-Sent Events (SSE). This class extends the native EventSource class and adds the ability to consume events as an AsyncObservable using the asObservable method. |
EventSourceResponse | A Response subclass that subscribes to an AsyncObservable and streams the values yielded by the observable to the client as Server-Sent Events (SSE). Optional property selectors can be provided to customize the serialization of the events. |
WebSocket | A drop-in replacement for the standard WebSocket class that provides an Observable interface for handling WebSocket connections. This class extends the native WebSocket class and adds the ability to consume events as an AsyncObservable using the asObservable method. |
Type Aliases
Type Alias | Description |
---|---|
EventSourceEvent | Represents the different native event objects that can be emitted by an EventSource. This type union covers all possible event types: error, message, and open events. |
EventSourceMessage | Represents a message event emitted by an EventSource. |
EventSourceResponseInit | Configuration options for creating an EventSourceResponse. Extends the standard ResponseInit interface with SSE-specific options. |
EventSourceSerializerInit | Configuration options for customizing how events are serialized into SSE format. Each property can be a function that extracts the corresponding SSE field from an event, or null to exclude that field from the output. |
Functions
Function | Description |
---|---|
eventSourceObservable | Creates an AsyncObservable from an EventSource instance. |
websocketObservable | Creates an AsyncObservable from a WebSocket instance. |