by pieter · 3y ago · 0 comments
Luckily since there’s nothing special about the browser support, you can very easily replace it with custom implementations. https://www.npmjs.com/package/@microsoft/fetch-event-source for example offers mostly the same API, but does offer POST requests and a bunch of other goodies.
I agree with the note about the auto retry mechanism of EventSource. It does no good, is unavoidable and a big annoyance. The work we had to do to work around it in Tracim (previous job) [1] was pure madness. I see this part has not been touched since I left by the way.
https://github.com/tracim/tracim/blob/develop/frontend_lib/s...
I've always used SSEs to open a more persistent comms channel to a browser which creates way more state and complexity both on the client and the server.