It doesn’t mention the big drawback of SSE as spelled out in the MDN docs: “Warning: When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6).”
One of my company's APIs uses SSE, and it's been a big support headache for us, because many people are being corporate firewalls that don't do HTTP/2 or HTTP/3, and people often open many tabs at the same time. It's unfortunately not possible to detect client-side whether the limit has been reached. Another drawback of SSE is lack of authorization header support. There are a few polyfills (like this one [1]) that si…
Server-Sent Events (SSE) Are Underrated
101–110 of 153 posts
Re: Server-Sent Events (SSE) Are Underrated
#102https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...
Edit: I see someone already posted about that
Re: Server-Sent Events (SSE) Are Underrated
#103Earlier quoted context omitted.
That might very well be but the future is not today.
But why add it to HTTP/3 at all? HTTP/1.1 hijacking is a pretty simple process. I suspect HTTP/3 would be significantly more complicated. I'm not sure that effort is worth it when WebTransport will make it obselete.
Re: Server-Sent Events (SSE) Are Underrated
#104Re: Server-Sent Events (SSE) Are Underrated
#105Earlier quoted context omitted.
There's no ack on a raw SSE stream, unfortunately -- unless you mean send an event and expect the client to issue an HTTP request to the server like a keepalive?
There should be an ACK on the tcp packet (IIRC it’s not a lateral ACK but something like it) and the server should handle a timeout on that as the connection being “closed” which can be returned to the connection opener. You might want to look into timeouts or error callbacks on your connection library/framework.
Re: Server-Sent Events (SSE) Are Underrated
#106Earlier quoted context omitted.
You can easily multiplex data over one connection/event stream. You can design your app so that it only uses one eventstream for all events it needs to receive.
This, it works well in a service worker for example.
Re: Server-Sent Events (SSE) Are Underrated
#107> Perceived Limitations: The unidirectional nature might seem restrictive, though it's often sufficient for many use cases For my use cases the main limitations of SSE are: 1. Text-only, so if you want to do binary you need to do something like base64 2. Browser connection limits for HTTP/1.1, ie you can only have ~6 connections per domain[0] Connection limits aren't a problem as long as you use HTTP/2+. Even so, I d…
ReadableStream appears to be SSE without any defined standards for chunk separation. In practice, how is it any different from using SSE? It appears to use the same concept.
Re: Server-Sent Events (SSE) Are Underrated
#108Earlier quoted context omitted.
There should be an ACK on the tcp packet (IIRC it’s not a lateral ACK but something like it) and the server should handle a timeout on that as the connection being “closed” which can be returned to the connection opener. You might want to look into timeouts or error callbacks on your connection library/framework.
Interesting, hadn't checked at the TCP level. Will need to look into that.
All this is done at the kernel level, so at the application level you should be able to just verify if the connection is open by trying a read from the socket.
Re: Server-Sent Events (SSE) Are Underrated
#109Re: Server-Sent Events (SSE) Are Underrated
#110It doesn’t mention the big drawback of SSE as spelled out in the MDN docs: “Warning: When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6).”
Http2 is controllable by you, since it's supposed in every browser. So, the way to fix this limitation is to use http2