Server compatibility
Better SSE works with any runtime that runs JavaScript (ES2020+) and supports the following APIs:
Request,ResponseandAbortControllerfrom the Fetch APIrandomUUIDfrom the Web Crypto APIEventEmitterfromnode:eventssetImmediatefromnode:timersIncomingMessageandServerResponsefromnode:http- Or at least stubs their imports to
undefinedif you are instead using the Fetch API
- Or at least stubs their imports to
Http2ServerRequestandHttp2ServerResponsefromnode:http2- Or at least stubs their imports to
undefinedif you are instead using the Fetch API
- Or at least stubs their imports to
Readablefromnode:stream- Or at least stubs its import to
undefinedif you are instead using web streams
- Or at least stubs its import to
ReadableStream,WritableStreamandTransformStreamfrom the Web Streams API- Only when using the Fetch API
For Node users, version 20 is the minimum officially supported version.
When using the Fetch API, the provided Request and optional Response object must be instances of globalThis.Request and globalThis.Response, respectively. Providing a ponyfilled implementation will cause an error to be thrown unless you also assign it to globalThis:
import { Request as PonyfilledRequest, Response as PonyfilledResponse} from "fetch-ponyfill"
globalThis.Request = PonyfilledRequestglobalThis.Response = PonyfilledResponse