EventSource is a good and simple API to easily implement streaming. At the moment, it's easy to generate an event source stream from a Cloudflare Worker, but it's not easy to consume one from a Clouflare Worker.
Most polyfills are incompatible with Cloudflare Workers:
While it's definitely possible to make a polyfill of EventSource works on Worker, it'd be great if this API could be natively supported, especially as the API surface is light and not browser-specific.
It looks like @cloudflare/ai also consumes an EventSource API, but it's unclear what polyfill is being used there and if the Cloudflare team could publish it as an open source package.
EventSourceis a good and simple API to easily implement streaming. At the moment, it's easy to generate an event source stream from a Cloudflare Worker, but it's not easy to consume one from a Clouflare Worker.Most polyfills are incompatible with Cloudflare Workers:
event-source-polyfillusesfetchoptions that are not supported by Cloudflare, I'll publish a forkeventsourcerelies onhttp/httpsmodule and doesn't work well with the browserify polyfillsWhile it's definitely possible to make a polyfill of
EventSourceworks on Worker, it'd be great if this API could be natively supported, especially as the API surface is light and not browser-specific.It looks like
@cloudflare/aialso consumes an EventSource API, but it's unclear what polyfill is being used there and if the Cloudflare team could publish it as an open source package.