Skip to content

Documentation / @eventkit/http / EventSourceSerializerInit

Type Alias: EventSourceSerializerInit<T>

ts
type EventSourceSerializerInit<T> = object;

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.

Type Parameters

Type ParameterDescription
TThe type of the events being serialized

Properties

getEvent?

ts
optional getEvent: (value, index) => string | null;

Function to extract the event data. If null, no data will be included. If undefined, the event will be JSON stringified if it's an object, or converted to string otherwise.


getId?

ts
optional getId: (value, index) => string | null;

Function to extract the event ID. If null, no ID will be included. If undefined, the event index will be used as the ID.


getType?

ts
optional getType: (value, index) => string | null;

Function to extract the event type. If null, no type will be included. If undefined, no type will be included.

Released under the MIT License.