App on mobile but don't need Meteor server?

Hi folks

I’ve succeeded in getting my app to look at a remote MySQL database just for reporting purposes using numtel:mysql and webix:webix - works just fine - props to @robfallows and @numtel

Now, I want to create an iOS mobile version of this, and while it works perfectly when my iPhone is plugged into my iMac after running “meteor run ios-device” on my local network on WiFi, as soon as I unplug and leave the house, I get nothing.

Obviously, because then I’m on 3G and it can’t connect to my local server.

All is good - I see the data on my iPhone when connected locally via WiFi to the local server running on the iMac.

But when I leave the house and get connected to 3G, I get nothing.

Is there no way to setup the client code to run on the phone’s data plan?

I even tried changing:

if (Meteor.isServer) {

to

if (Meteor.isCordova) {

for the Meteor.publish code, but still no luck.

Do I really have to setup a Meteor “server” somewhere, to get this to work, given that I’m not directly publishing collections from Mongo on the server to be subscribed to on the client?

Just wondering where to go from here to get it to work.
I might also add that I want to get this working on Android too.

Thanks in advance for any replies - what a great community!

If you don’t need internet communication you might want to take a look at https://atmospherejs.com/ground/db

If your phone cannot connect to your home iMac, you will not get any data.

Your phone app in the development mode will want to connect to your computer by the local IP in the network (your wifi router assigns them). In the global Internet, this local IP wouldn’t work. You would need to deploy your app to a public-facing domain and then recompile your mobile app to access the server via that name.

Thanks @slava

Yes I’ve got it now.

Here’s my internal mind layout:

+-+             <--------------------------+
| |                                        |
| |      phone                             |
+-+                                        |
                                           |
 |                                         |
 |                                         |
 v                                         |
                                           |
+-----+                                    |
|     |                                    |
|     |    meteor server                   |
|     |                                    |
+-----+                                    |
                                           |
   |                                       |
   |                                       |
   v                                       |
                                           |
+-----+                                    |
|     |                                    | 
|     |    remote server                   |
|     |                                    |
+-----+                                    |
                                           | 
   |                                       |
   +---------------------------------------+

The phone can’t directly connect to the remote server,
and only the Meteor.isServer() code gets deployed to the Meteor server,
from where it can connect to the remote server and publish the
collections that the client (phone ie: Meteor.isClient) subscribes to.

I’ve got it now.

Thanks.