my Server side code Meteor.methods({ 'doCount': function(){ var x = ProductList.find().count(); console.log(x); return x; } });
and client side code Meteor.call('doCount', function(error, result) { console.log("lenght of counters variable is "+counters.length); var queryResult = ProductList.find().fetch(); for(i=0 ; i< result; i++){ console.log("current Time >>> "+ TimeSync.serverTime(); console.log("expire Time "+ queryResult[i].expire); } });
Two problems found, #1
I don’t know what exactly is going on, I tried with TimeSync.resync(); and then pasted your code and it worked only once. I refreshed the browser and it’s gone.
What you could do is perhaps assign the server time to a session variable (since it possibly is global). That will make sure the sync takes place at its predefined interval and necessary reactive variables get updated.
You could then log the value of that session variable from within your client method.
I’m suggesting this because I believe you are having an issue with reactivity.