Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Gzip support #69

Closed
andreialecu opened this issue Dec 13, 2015 · 15 comments
Closed

Gzip support #69

andreialecu opened this issue Dec 13, 2015 · 15 comments
Milestone

Comments

@andreialecu
Copy link
Contributor

In my app's case, JS updates are rather big, 1 MB+. They would greatly benefit from being gzipped, but I'm not sure if the plugin supports this or not.

Would also be cool if the cli would have an option to gzip the files before uploading them to s3.

@alexbuijs
Copy link
Contributor

👍 Same here. Gzipping and fingerprinting the assets on cordova-hcp build, deploying only those files to S3 and then unzipping them in the app would be really awesome!

@nikDemyankov
Copy link
Member

Nice suggestion, thanks for the idea!

@lorenzyannick
Copy link

You can do a gzip compression on your server side. That's not enought ?

@andreialecu
Copy link
Contributor Author

There are no guarantees that the plugin code knows how to ungzip files, and I haven't checked if it does. Perhaps @nikDemyankov can clarify.

@hassellof
Copy link
Contributor

There is no need to handle unzipping in the app if you set the correct headers on the file S3 upload, it will be handled transparently by the networking component since this is supported behaviour in HTTP protocol.

@andreialecu
Copy link
Contributor Author

@hassellof
Copy link
Contributor

I see.

What I have done on the S3 side before in other projects is simply to gzip files before uploading them (without changing the filename, i.e. not appending the .gz extension) and then setting the header "content-encoding:gzip" on each uploaded file. Works like a charm in browsers and webviews.

I only wrote the chcp-cli and not the native code, but by looking at @nikDemyankov s code I think you are right @andreialecu, it will not currently be supported on Android. I'm no Android dev so I could be way off, but after a quick glance at the code I think the easiest fix is to check for content-type gzip in the response and if it's there pipe the input stream via GZIPInputStream. See http://www.rgagnon.com/javadetails/java-HttpUrlConnection-with-GZIP-encoding.html

NSURLSession on iOS should support it right out of the box though, so I don't expect any changes to be needed there. We should probably verify that though :)

@nikDemyankov
Copy link
Member

Haven't checked this yet, so can't do any clarification on the question. But I think @hassellof is right. Will look into that after fixing some bugs.

@sckoh
Copy link

sckoh commented Apr 22, 2016

I'm using gzip compression on my web server.
and my ios and android device can update the app successfully.
so I think gzip is supported by default?

@nikDemyankov
Copy link
Member

Hmm, maybe :) Good to hear, that it worked for you. But I will still add code to handle gzip compression on Android side. No changes are required for iOS, though.

@nikDemyankov nikDemyankov modified the milestones: v1.4.0, v1.3.0 Apr 22, 2016
@nikDemyankov
Copy link
Member

Hmm, actually, Android also supports it by default - http://developer.android.com/intl/ru/reference/java/net/HttpURLConnection.html . So, probably, no changes are required :)

@nikDemyankov
Copy link
Member

Closing it, since no code update is required. Gzip should work out of the box for both platforms. If not - please, reopen the issue.

@seme1
Copy link

seme1 commented Aug 29, 2016

would be nice if cli automatically gzips content before uploading them to s3.
nordnet/cordova-hot-code-push-cli#33

@seme1
Copy link

seme1 commented Aug 29, 2016

This may be useful ? I've never used gulp so, not sure how to implement with cli.
https://alyssaq.github.io/2015/deploy_gzip_site_s3/

@nikDemyankov
Copy link
Member

@seme1 it might be, thanks :) Although, this should go to nordnet/cordova-hot-code-push-cli#33 , not current thread.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants