Created
August 10, 2012 16:09
-
-
Save MeLight/3315278 to your computer and use it in GitHub Desktop.
Why don't I get notifications on the client?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Client | |
Meteor.autosubscribe(function() { | |
console.log("Subbed to request"); | |
Meteor.subscribe("requests", Session.get('player_id'), function(){ | |
var call = Requests.findOne(); | |
console.log("in request (call: " +call+")"); | |
Meteor.call("answerCall", call._id); | |
}); | |
}); | |
//Server | |
Meteor.publish("requests", function(player_id) { | |
console.log("player_id: "+player_id+", log count: "+Calls.find({toUser: player_id, status: "request"}).count()); | |
var self = this; | |
var handle = Calls.find({toUser: player_id, status: "request"}).observe({ | |
added : function(doc) { | |
self.set("requests", doc._id, doc); | |
self.flush(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment