Guest User

Untitled

a guest
Jan 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. collexn = new Meteor.Collection("collexn");
  2. if(Meteor.isClient) {
  3. // client code
  4. }
  5. if (Meteor.isServer) {
  6. APP={};
  7. APP.updateDatabase = function(ch,msg) {
  8. collexn.insert({'channel': ch,'message': msg}); // insert not happening
  9. console.log("updateDatabase with channel = "+ch+"and message = "+msg);
  10. // above line prints the same data every time
  11. }
  12. Meteor.startup(function () {
  13. // code to run on server at startup
  14. var redis = __meteor_bootstrap__.require("redis"),
  15. client = redis.createClient();
  16. client.subscribe("testchannel");
  17. client.on("message", function(channel, message){
  18. console.log(channel + ": " + message); // prints same data every time
  19. APP.updateDatabase(channel,message);
  20. });
  21. });
  22. }
Add Comment
Please, Sign In to add comment