How to prevent a Meteor/Cordova App from connecting to 10.0.2.2? (And why does the app connect there?)

本秂侑毒 提交于 2019-12-03 03:40:46

So even when you set your ROOT_URL correctly there are still special variables for mobile versions of it which do not get set and may contain localhost. And there seem to exist more code snippets in the meteor project which replace localhost with 10.0.2.2 aside from the one I mentioned above, when a Cordova client is connecting. So that seems to cause my app to reconnect to 10.0.2.2.

The mobile URL variables I could find are process.env.MOBILE_ROOT_URL and process.env.MOBILE_DDP_URL. So in a Meteor.startup() function I now set those to my real ROOT_URL on the server side. My Android (Cordova) app now still is reconnecting a few seconds after its first start up but it's reconnecting to the same (and real) server URL (thus everything works fine)!

I still don't know why its reconnecting and those mobile variables and their use don't seem to be very well documented (or I missed something) but I can live with the way things work now.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!