meteor run ios-device --mobile-server http://192.168.2.126:3000
works fine, but when i do an update to the code of my app while this command is running, it correctly refresh code in the application but pointing to a wrong data source, returning this error on the app:
Failed to load resource: Could not connect to the server. http://localhost:3000/sockjs/info?cb=fpbx3y94_g
To give a little more context to @pahans question:
Because subsequent updates delivered through Hot Code Push replace the initially bundled index.html with a freshly generated one, the server should also be configured with the right connection URL.
Using meteor deploy takes care of setting these values automatically, so there is no need to specify anything in that case. But when deploying on your own server, you have to make sure to set at least the ROOT_URL environment variable (DDP_DEFAULT_CONNECTION_URL defaults to the same value). For Meteor Up for example, you can configure this in mup.json.
Hi, i just try launching my app like: ROOT_URL=http://192.168.1.126:3000 meteor run ios-device --mobile-server=http://192.168.1.10:3000 but i have the same problem…
Here is my steps:
I start my server like: ROOT_URL=http://192.168.1.126:3000 meteor
Start my apps (installed using the ROOT_URL=xxxx meteor run ios-device etc…)
You don’t have to set the ROOT_URL when you use meteor run, that is what the --mobile-server option is for. And you only need to specify it if the default IP address detection doesn’t give you the right address, so usually only when you run the server on a different machine.
Maybe I’m misunderstanding what is going on, but I thought you were running the app on a separate server, not as part of meteor run. Is that not the case?
Yes, you are right. I need to start a server and i have a lot of clients like browsers and apps that have to link this server. I have a local network connection, and i need to update clients via wireless everytime i update my code bacause i have a lot of clients in this network… everything works fine on iOS/ Android and browsers clients if i not edit my code… but for example if i change a color of a button in html code meteor refresh the clients and i have the error only on apps (browsers works correctly)
then i start my application on iOS (I install it befare on iPad using ROOT_URL=http://192.168.1.126:3000 meteor run ios-device --mobile-server=http://192.168.1.10:3000 )
On server and client I’m not using deployed version or meteor up, i’m using directly meteor command to start webserver and mongodb…
Is this the problem? I need a deployed version of my app for sync work correctly? Why i can’ t use directly meteor command? Is this a problem for performance?
i just try with --mobile-server without using ROOT_URL but i have the same problem.
The correct ip is 192.168.1.126 i have type wrong when i put .10 sorry…
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
process.env.MOBILE_DDP_URL = ‘http://192.168.1.151:3000’;
process.env.MOBILE_ROOT_URL = ‘http://192.168.1.151:3000’;
});
}
I’m glad you got it working, but an easier solution that would give you the same effect is to specify --mobile-server when running the server, that should set these environment variables internally.