Is there a way to let code on the server react to a Session.variable on the client?
eg:
if(Meteor.isClient() {
Template.main.events({
'click #appleBtn': function() {
Session.set('fruit', 'apples')
}
})
}
if(Meteor.isServer) {
if(Session.get('fruit') == 'apples') {
doSomething()
} else {
doAnotherThing()
}
}
My initial idea is to have a clientside code continuously send the value of the session variable to the server via a method call, but that doesnt seem too efficient.
Sessionon the server, it's not very interesting. Can you instead post the code which uses a method call to send theSessiondata and explain why it is does not "seem too efficient"?