UNPKG

@fanoutio/eventstream

Version:

Connect-compatible middleware that enables the easy creation of EventStream endpoints

14 lines 681 B
/** * tools for encoding objects to text/event-stream strings * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format */ /** * encode an event * @param fields - Fields to encode into the event, e.g. { data: 'foo' } * @param comments - Any comments to encode into event. They will be ignored by most clients. * Comments are printed before fields * @returns text/event-stream encoded event */ export declare function encodeEvent(fields?: object, comments?: string | string[]): string; export declare function joinEncodedEvents(encodedEvents: string | string[]): string; //# sourceMappingURL=textEventStream.d.ts.map