Server compatibility
Better SSE works with any runtime that runs JavaScript (ES2020+) and supports the following APIs:
Request
,Response
andAbortController
from the Fetch APIrandomUUID
from the Web Crypto APIEventEmitter
fromnode:events
setImmediate
fromnode:timers
IncomingMessage
andServerResponse
fromnode:http
- Or at least stubs their imports to
undefined
if you are instead using the Fetch API
- Or at least stubs their imports to
Http2ServerRequest
andHttp2ServerResponse
fromnode:http2
- Or at least stubs their imports to
undefined
if you are instead using the Fetch API
- Or at least stubs their imports to
Readable
fromnode:stream
- Or at least stubs its import to
undefined
if you are instead using web streams
- Or at least stubs its import to
ReadableStream
,WritableStream
andTransformStream
from 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