gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
29.49k stars 2.19k forks source link

move away from `EventSource` #8207

Open pngwn opened 2 weeks ago

pngwn commented 2 weeks ago

Is your feature request related to a problem? Please describe.

EventSource has a number of issues:

Describe the solution you'd like

I think we should switch to the Web Streams API which is supported in more environments. More specifically i think we should use fetch-event-stream because:

See the following from the repo:

  • Allows any HTTP method
  • Built with native Web Streams API
  • Works with browser, Node.js, Cloudflare Workers, Deno, and Bun
  • Supports WebWorker or Service Worker environments
  • Accepts AbortController for cancellable streams

I also think we should change the streaming API, but I'll open a new PR for that.

hannahblair commented 2 weeks ago

Nice, thanks for making an issue for this!

pngwn commented 2 weeks ago

Issue for the API changes: #8208