I've gotten GZip HTTP compression working for the Sync Gateway and the iOS 
Couchbase Lite. This should save quite a bit of bandwidth during replications, 
since JSON tends to compress to about half its size.

Here's what gets compressed:

 1.  JSON response bodies from the Gateway (if the client sends an 
"Allow-Encoding: gzip" header, which pretty much everything does)
 2.  JSON parts of MIME multipart responses from the Gateway (i.e. the document 
bodies in a GET-with-attachments or a _bulk_get)
 3.  JSON request bodies sent by CBL/iOS, including _bulk_docs and _revs_diff
 4.  JSON parts of MIME multipart document uploads from CBL/iOS

This should all Just Work, with no apparent change other than lower data usage, 
as long as you've got the latest master-branch bits from both repos.

Only #1 above is a well-supported standard feature. The others are still valid 
HTTP but not commonly supported on the receiving side, so they aren't enabled 
by default. To enable #2, CBL/iOS sends a special header 
"X-Accept-Part-Encoding: gzip" with the request, which the gateway checks for. 
To enable #3 and #4, CBL/iOS checks the server's "Server:" response header to 
see if it's Sync Gateway 0.92 or later. So I don't believe this will break 
interoperability with older versions of the Gateway, or earlier versions of CBL 
(or Android), or CouchDB.

(Android support will require implementing the equivalents of commits 
7d54535f08<https://github.com/couchbase/couchbase-lite-ios/commit/7d54535f08d2d9e6f47adae5000873d08d4187a7>,
 
d5afe611ee<https://github.com/couchbase/couchbase-lite-ios/commit/d5afe611eedcb2348540b2da76525ea954679ac7>,
 
cb27792d98<https://github.com/couchbase/couchbase-lite-ios/commit/cb27792d982d4197422828244338ba91cecf240c>.
 It's pretty straightforward.)

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/A5B7194D-5238-4FB5-AC93-4AA504792547%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to