3

Does Firebase GZIP or do any other kind of compression/optimization before sending in either direction? I can't find any mention of this happening, and the REST API clearly doesn't do this, but for all I know there is some magic happening in client-side Firebase JS that compresses/decompresses when sending/receiving.

Some of the attribute names I use are pretty long, to make my code more readable, and I have large quantities of otherwise-small objects.

Gzipping all of the JSON in my Firebase reduces its size by 85%, though there are also a lot of large strings which probably account for plenty of this compression. I don't actually need very granular access to the data in my app, so now that I think of it I'm tempted to do some compression myself (JavaScript implementation of Gzip) on stringified JSON.

Related question: Is it worth the effort to try to reduce JSON size?, which references JSONH which looks interesting.

Community
  • 1
  • 1
tobek
  • 4,349
  • 3
  • 32
  • 41
  • 1
    You can check if there is compression by simply doing a `curl -I [url]` from the command line. That will show you full headers including ones that indicate whether an item is compressed or not. – Giacomo1968 Dec 29 '13 at 03:21
  • For Firebase's REST API, `curl -I` gives me `405 Method Not Allowed`, but doing `curl -v` I can see the headers and it appears that it is not compressed. However, I still don't know what's going on inside the client-side Firebase JS - I believe it's using web sockets and nothing is showing up in the Chrome dev tools network tab. – tobek Dec 29 '13 at 03:37
  • How about doing `curl -I -H 'Accept-Encoding: gzip,deflate' [url]` as explained on this site. http://www.if-not-true-then-false.com/2010/curl-tip-check-that-the-apache-compression-gzip-deflate-is-working/ – Giacomo1968 Dec 29 '13 at 04:23
  • Nope, still not compressed. But anything that I do with `curl` over the REST API is irrelevant to what Firebase is actually doing in my application, which I believe uses different methods to access and update that date. – tobek Dec 29 '13 at 04:30
  • 1
    Firebase doesn't do any compression on its own in the JS library. If you don't need granular access, I recommend compressing/uncompressing the data on your own. – Anant Dec 30 '13 at 19:52
  • It would be great if there were a way to enable compression. JSON can be very compressible. – chrishiestand Apr 10 '15 at 23:41

0 Answers0