-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
The README mentions that you obviously have to close the stream manually, if you use the keepalive config. Thing is, the API doesn't seem to provide a way to actually do that 😅 and the controller property is protected 🙈.
My workaround for now:
export type SSE = typeof ServerSentEventGenerator.prototype;
export const closeStream = (stream: SSE) => {
try {
((stream as any).controller as ReadableStreamController<any>).close();
}
catch(err) {}
}(The try/catch exists, because there is no way to check if the stream already is closed and closing it multiple times results in an error. Yet onAbort has the tendency to be called multiple times.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels