GithubHelp home page GithubHelp logo

Comments (10)

nikDemyankov avatar nikDemyankov commented on July 19, 2024

Hi,

Setting config-file to local server: https://4961a61c.ngrok.com/chcp.json

When you execute cordova-hcp server CLI client creates .chcpenv file in the root of your Cordova/Ionic project. In your case:

{
  "content_url": "https://4961a61c.ngrok.com",
  "config_url": "https://4961a61c.ngrok.com/chcp.json"
}

When project is build - after_prepare hook from the plugin get's executed. He reads this file, takes config_url and puts it in the platform specific config.xml. Why he does that? Well, so you would not have to do that.

I noticed the ngrok.com is not accessible and suspected it was the cause of failure.

Yes, if you can't open https://4961a61c.ngrok.com/chcp.json - then ngrok is not reachable or not running. If you change hostname to the ip address, then you need:

  1. Check, that it is accessible via browser: http://192.168.108.98:31284/chcp.json.

  2. Either change in .chcpenv hostname 4961a61c.ngrok.com to 192.168.108.98:31284. Or in plugins/cordova-hot-code-push-local-dev-addon/scripts/afterPrepareHook.js on line 138 change

    var localServerURL = getLocalServerURLFromEnvironmentConfig(ctx);
    

    to

    var localServerURL = 'http://192.168.108.98:31284';
    

from cordova-hot-code-push-local-dev-addon.

johnmiroki avatar johnmiroki commented on July 19, 2024

Hi Nic. Thanks so much for your prompt reply. I'm glad you mentioned .chcpenv file. I had tried to modified it but every time I ran cordova-hcp server, the file would be set to its default ie https://4961a61c.ngrok.com . now I am going to modify afterPrepareHook.js instead and let you know how it goes.

from cordova-hot-code-push-local-dev-addon.

johnmiroki avatar johnmiroki commented on July 19, 2024

I modified afterPrepareHook.js file according to your instruction

var localServerURL = 'http://192.168.108.98:31284/chcp.json';

and now the cordova-hcp server can report "a user connected". however, on the app side, there's no update or reload action after I modified index.html.
Going to learn and investigate. Any further suggestion? Thanks again!

from cordova-hot-code-push-local-dev-addon.

johnmiroki avatar johnmiroki commented on July 19, 2024

Tried both on emulator and actual mobile phone, both failed. The cordova-hcp server reports:

a user connected
File changed:  D:\playground\TestHCP\www\index.html
Config { name: 'test',
  ios_identifier: '',
  android_identifier: '',
  update: 'now',
  content_url: 'http://192.168.108.98:31284',
  release: '2016.01.08-17.31.45' }
Build 2016.01.08-17.31.45 created in D:\playground\TestHCP\www
Should trigger reload for build: 2016.01.08-17.31.45

so I guess the problem is on the app side? any suggestions? Thanks!

from cordova-hot-code-push-local-dev-addon.

nikDemyankov avatar nikDemyankov commented on July 19, 2024

If you see in console a user connected - then emulator/device did connect to the server via sockets and listening for the updates. So most likely, it can't download new content.

Open platforms/ios/YOUR_PROJECT_NAME.xcodeproj in Xcode and launch the app to see the logs in Xcode console.

Also, on your emulator launch Safari and open http://192.168.108.98:31284/chcp.json. If it's not opening, then use http://localhost:31284/chcp.json instead. If localhost is opening - use it instead of the ip address.

Also, after opening chcp.json in Safari - check, that content_url property is set correctly. For example:

{
  "autogenerated": true,
  "release": "2016.01.08-11.00.04",
  "content_url": "http://localhost:31284",
  "update": "now"
}

from cordova-hot-code-push-local-dev-addon.

johnmiroki avatar johnmiroki commented on July 19, 2024

Hi Nik, I finally figure out what was wrong. There's nothing wrong with the plugin per se. The plugin would phone home and get chcp.json successfully. But it wouldn't be able to subsequently ask for the manifest with success, cuz I realized I'd have to set up a dev version of cordova-hcp.json for cordova-hcp cli, so that it will generate proper chcp.json (to be exact, content-url pointing to local server) for development purposes. It's a bit inconvenient, I kinda hope the local-dev-plugin can kick in and modify the cordova-hcp.json for me. But anyway, good work! Thanks!!! I'm going to explore more on the hot code push plugin itself. See you there?

from cordova-hot-code-push-local-dev-addon.

nikDemyankov avatar nikDemyankov commented on July 19, 2024

Hi,

Glad to hear, that you find the problem :) It's strange, that you had to do that. Will look into this.

I'm going to explore more on the hot code push plugin itself. See you there?

Sure, if you find a bug or hit some problem - just post a question in there.

from cordova-hot-code-push-local-dev-addon.

johnmiroki avatar johnmiroki commented on July 19, 2024

I'm a novice so don't bother look into the so-called problem just yet. Maybe there isn't anything wrong after all, just me being silly lol. Now I've adjusted my workflow a little: put aside the local dev addon, and only use cordova-hcp build to generate manifest after I change something in the www folder, then I start up my own http server:

python -m SimpleHTTPServer 8081

This way I'll be able to focus on testing and developing around the hot code push plugin. Of course it also means I'll have to modify config.xml() and cordova-hcp.json(content_url) before deploying to production environment. (just keeping a record here for novices whoever may face similar problems to mine)

from cordova-hot-code-push-local-dev-addon.

nikDemyankov avatar nikDemyankov commented on July 19, 2024

Good, thanks for the info :)

from cordova-hot-code-push-local-dev-addon.

nordnet-deprecation-bot avatar nordnet-deprecation-bot commented on July 19, 2024

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

đŸ˜ĸ We are not using nordnet/cordova-hot-code-push-local-dev-addon 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 #29 for more information.

from cordova-hot-code-push-local-dev-addon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.