eventsource
eventsource copied to clipboard
Support Accept-Encoding: gzip
Streaming text data (Event-source) is a perfect candidate for gzip. It would be awesome if this module supported gzip.
It can be enabled by default safely:
- Announce gzip support with the
Accept-Encoding
header - Only decompress the response if the server responds with
Content-Encoding: gzip
See https://stackoverflow.com/a/14739453/977939.
Does EventSource specification support GZip compression? If not, you stil can do the compression yourself...
True, it's not in the spec though all browsers support it, so it's more of a nice-to-have - can close if not interested :+1:
On Thu, 21 Sep 2017 at 17:01 Jesús Leganés-Combarro < [email protected]> wrote:
Does EventSource specification support GZip compression? If not, you stil can do the compression yourself...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EventSource/eventsource/issues/86#issuecomment-331070075, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmr80QkpSVgEhkjWCvlSGVUIUepG1yyks5skgnNgaJpZM4PeshZ .
all browsers support it
Have you done any test for that? I know brosers adds the header, but if it works with EventSource requests, it would be interesting to implement it...
See https://velox.jpillora.com/ and open Dev Tools (this server is written in Go):
![screen shot 2017-09-21 at 10 59 21 pm](https://user-images.githubusercontent.com/633843/30696902-8c9b350e-9f20-11e7-9835-56dc03a64b35.png)
Definitely supported in Chrome and Firefox, haven't tested IE and others though can't imagine why they also wouldn't work
The EventSource protocol is built on top of the HTTP protocol, so if gzip is supported in HTTP (it is), that makes it implicitly supported in EventSource too, doesn't it?
The EventSource protocol is built on top of the HTTP protocol, so if gzip is supported in HTTP (it is), that makes it implicitly supported in EventSource too, doesn't it?
I think so, just only it seemsed to me to be a corner case and wanted to confirm if it actually worked. Having confirmed that, pull-requests are welcome :-) I think it can be checked and done directly and explicitly, or maybe by using gunzip-maybe, but it could add some boilerplate, too.