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

Plugin differences/benefits #131

Closed
blahtao opened this issue Apr 8, 2016 · 4 comments
Closed

Plugin differences/benefits #131

blahtao opened this issue Apr 8, 2016 · 4 comments
Labels

Comments

@blahtao
Copy link

blahtao commented Apr 8, 2016

After browsing this & other app updater type plugins it's not really clear to me what the differences/benefits of this plugin compared to these 2 are:

https://github.com/phonegap/phonegap-plugin-contentsync
https://github.com/markmarijnissen/cordova-app-loader

It seems like this one is a bit more complicated - but maybe that's actually just better documentation & perhaps more features. Would someone mind sharing their insight here?

@nikDemyankov
Copy link
Member

Sorry for the late answer.

You might find some useful info in this thread.

I'm not gonna do the detailed comparison, only in short, since I don't have experience in using these two plugins.

Anyway, both solutions are a good ones. Although all three plugins allows you do to the same thing (update the app content) - they are doing this in slightly different ways. Which one is best for you - it is for you to decide.

cordova-app-loader is a pure JS plugin, that uses manifest file to detect, what files to download from the server and use. This approach is good, because it allows you to download only updated files instead of loading the whole project. JS API is quite simple, which is also good and easy to use. Plus, pure JS approach has one main benefit for plugin developer and his users: developer can implement some feature for several platforms at once (with some tweaks, of course, but still). But since this is a JS plugin - all code is run in the webview, which (for me) can be potentially dangerous. If it runs on the native side - there's just less chances of breaking, plus better control of the device's platform and less dependencies on the Cordova itself.

phonegap-plugin-contentsync is a native plugin with good JS API, which allows you to launch the update process and listen for different events during it. Since the actual work is done on the native side - this should be more reliable, then pure JS approach. Although, it is hard to maintain native code for several platforms and takes more time to add new features. If I understood correctly, this plugin is loading zip archive with your project and installs it in the custom www folder. There are different mechanics for that, which is good: you can either change the whole project, or let plugin to somehow merge them. But it requires a bit more work from the app developer's side to implement the update flow, which can be tricky. Another problem, is that plugin will download zip archive every time without checking if there is really anything new on the server. Archive approach has another potential problem: if user missed several updates - archive on the server might not be correct for him, or he will have to download several of them step-by-step, reloading page several times. So this can also become a bit tricky.

cordova-hot-code-push-plugin is a pure native plugin with JS API that you can use to download/install updates. He is some sort of the mix of these two plugins. Yes, it is a bit more complex, since has more configs. But when you wrap your head around them - it should be quite simple. chcp.json is an entry point for the plugin. In there you define url to you web project on the server, web content version and minimum required native version to run it. The last one is, actually, a nice feature, since it allows you to protect users from installing web content, that native side yet doesn't support. chcp.manifest is a file, where you define paths to your web project files and their hashes (versions). When plugin launches - it first loads chcp.json and checks, if new update is available and if it can be installed in the current version of the application. If so - it the loads chcp.manifest to detect, which files has changed since the last update. This way, even if user skipped several updates - plugin will know, what needs to be changed in the app and download only changed/updates files. Then it will put all project files in the separate folder and load index.html from it. Also, it will store the previous version as a backup just in case.

CHCP plugin also has a CLI client utility, which you can use to generate configuration files or to run local server. And a cordova-hot-code-push-local-dev-addon plugin will help you to do the local development with this plugin: it will capture changes, that you do in the www folder and upload them on the testing devices/emulators, so you could see the changes immediately.

You can read in more details on how plugin works in the documentation. I tried to document it well enough, so it would be easier for others to use and understand the workflow. But the main idea was to let the plugin to do all the hard lifting and minify the JS code, that developer need to write to perform the update. You can even skip it fully, if you want.

But anyway, I would say - just try them out and choose, what is better suits your needs :) That's a beauty of open source: there's a lot of different solutions to choose from and you can always adjust it to your needs, if required.

@blahtao
Copy link
Author

blahtao commented Apr 15, 2016

Ah very awesome, just what I needed. Thank you so much @nikDemyankov This eliminates one of them from my list & then as you say, I will just try the other 2 out.

My 2 cents is that it's worth having something like this available in the readme since the current landscape of updater type plugins is confusing to those of us with limited time to try them all out. Perhaps also separating the documentation into multiple pages so that only the basics, including getting something running fast is up front, then the details can be linked to in separate pages. ie something similar to https://github.com/j3k0/cordova-plugin-purchase - not to say that it is the perfect example, but that's the one on top of my head :)

Not trying to be bossy or anything here, just brainstorming ways to make the project clearest to newcomers, including those that just want to find the right solution for their needs asap since not all of us have the time/resources to give all the solutions a test drive. On the documentation details, it looks like you've done an awesome job, but my initial reaction was something like "oh man I have to learn all this stuff before I can use it...ugh...", so to your point that much of this could even be skipped, I'm thinking it would be helpful to just put it in a separate page so that less energetic people like me aren't scared off on first sight unnecessarily. It's clear you're investing a lot of good energy into this project & it looks super robust, so it would be great to see something like this rise to the top of the pile - which I think a little marketing (even just something along the lines of clarifying the project's differentiation/benefits & getting started fast) would go a long way towards.

Again only my best here on everything, trying to give hopefully useful feedback since the project looks great & I really sincerely appreciate the time you took for this nicely detailed response. Thanks man & good luck!

@nikDemyankov
Copy link
Member

@blahtao thanks for suggestions. I agree, that having all docs on one page can be a bit too much for newcomers. I should break it into separate wiki pages.

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #371 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants