[x] I have searched to see if a similar issue already exists.
Is your feature request related to a problem? Please describe.
EventSource has a number of issues:
it is only available in browsers, we resolve the issue with node by using a polyfill but this does not resolve the issues for non-node, non-browser environments. #4348
it is not possible to set custom headers, this require us to work around authentication issues using a JWT and a special query param but this is far from ideal as it requires an additional network request, and is another remote API we need to keep up top date with. Additionally, while this works for spaces, it will not work when arbitrary headers are required. #7833
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:
it is tiny (less than 1kb).
it works in all environments (ish).
it support worker environments, which may be helpful for @gradio/lite.
I know the author and know it is a high quality library.
It will allow us to use any HTTP method + set arbitrary headers.
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:@gradio/lite
.See the following from the repo:
I also think we should change the streaming API, but I'll open a new PR for that.