I am working with offline support of Meteor Application. I have researched about this support but all are giving one answer ‘ground:db’. I looked into that solution its really nice effort by @raix. I started with that package, Its already working project so first task i have done that all collection i have grounded with following syntax
var Users = Meteor.users;
if(Meteor.isClient){
SmtGroundCollections.Users = Ground.Collection(Users);
}
After that i have tried with my offline application but still its showing loading and i am not getting my dom elements after that i have tried with that all waitOn subscription i have put on condition
if(Meteor.status().connected){
/* my subscriptions */
}
After that i am able to see my dom and if i visited that page when i am online then after i am going offline i am able to see my data.
Now i am explaining my problems.
When i am calling my methods its not updating my ground collection if i am offline. I used below code for resume my methods
Its working fine when i am coming from offline to online its syncing my data to server but i am not able to immediate effect.
If i want full application offline then i need to visit every page of my mobile application and then i can get that data in offline but its not possible so i want one centralise thing where i will press button and i can grounded my all data which i want offline.
It seems that your method inserts an object in MiniMongo Meteor.users (Profile.insert(obj);) which is not grounded.
What if your change return Profile.insert(obj); by return SmtGroundCollections.Profile.insert(obj); ?
You can use a cursor to always sync online -> groundDB.
eg:
var cursor = Profile.find(); SmtGroundCollections.Profile.observeSource(cursor);
But that means you have to be sure, when back online, that offline new data is sent to the server BEFORE the server sends back the the data. If not, all you offline data will be erased with the data present on the server before the user disconnexion. Meteor method resume mechanism should handle that.