ground-db icon indicating copy to clipboard operation
ground-db copied to clipboard

Ground.methodResume is a little bit confusingly described

Open pgrm opened this issue 9 years ago • 3 comments
trafficstars

I had some hard time understanding how Ground.methodResume works. Here are the issues I've had:

  1. It starts in the Concept paragraph, which states Ground.resumeMethods instead of methodResume (slight detail, but adds on to the confusion)
  2. I don't think the provided example really helps, it didn't help me at all:
// This is how grounddb uses this internally
Ground.methodResume([
  '/' + self.name + '/insert',
  '/' + self.name + '/remove',
  '/' + self.name + '/update'
], self.connection);

What I got out of this and how I'm using it now could be summarised in the following sentence:

When you to have your server-methods automatically run / resumed on the server, after a connection is established you need to tell this to Ground via Ground.methodResume. For instance:

Ground.methodResume('serverMethod');
Ground.methodResume(['serverMethod2', 'serverMethod3']);

This is also, how I'm using it now, and it seems to work fine. If that's the correct way, maybe the documentation can be adapted to be easier to understand?

Thx

pgrm avatar Nov 30 '15 23:11 pgrm

Its just about telling grounddb what methods are resumable/should be resumed on reconnect. I take pr's :)

raix avatar Dec 01 '15 05:12 raix

PR is here, hope to your satisfaction :) - in which case, 23 to go (http://24pullrequests.com/)

pgrm avatar Dec 01 '15 20:12 pgrm

I have this method which i need to be call offline

 Meteor.call('programs', remoteHost, diseaseId,deviceToken, function(err, data){
        if(!err) {
                 // do something
        }

how can i do this the Ground.methodResume method? Thank you.

vinodb2806 avatar Feb 12 '16 09:02 vinodb2806