Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- collexn = new Meteor.Collection("collexn");
- if(Meteor.isClient) {
- // client code
- }
- if (Meteor.isServer) {
- APP={};
- APP.updateDatabase = function(ch,msg) {
- collexn.insert({'channel': ch,'message': msg}); // insert not happening
- console.log("updateDatabase with channel = "+ch+"and message = "+msg);
- // above line prints the same data every time
- }
- Meteor.startup(function () {
- // code to run on server at startup
- var redis = __meteor_bootstrap__.require("redis"),
- client = redis.createClient();
- client.subscribe("testchannel");
- client.on("message", function(channel, message){
- console.log(channel + ": " + message); // prints same data every time
- APP.updateDatabase(channel,message);
- });
- });
- }
Add Comment
Please, Sign In to add comment