Sometimes I want to chain meteor methods where
- the initial method comes from the client
- subsequent methods are called from the server
I want the subsequent methods to not be called from the client e.g.
if (this.connection) {
throw new Meteor.Error('called-from-client', 'Error')
}
But, if the initial method is called then connection is still defined.
// Client
Meteor.call('firstMethod');
// Server
Meteor.methods({
firstMethod: function () {
Meteor.call('serverOnlyMethod');
},
serverOnlyMethod: function() {
// throw error if called from client
}
})
Has anyone found a way to distinguish?