{"size": 873, "ext": "js", "max_stars_repo_path": "server/publications.js", "max_stars_repo_name": "mariushop/latchat", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/publications.js", "max_issues_repo_name": "mariushop/latchat", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/publications.js", "max_forks_repo_name": "mariushop/latchat", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.1612903226, "max_line_length": 77, "alphanum_fraction": 0.6689576174}
Meteor.publish('allChannels', function(){
  return Channels.find();
});

Meteor.publish('allMessages', function(subscribedChannelName){
  var channelID = Channels.findOne({name: subscribedChannelName})._id;
  console.log(channelID);
  return Messages.find({channel: channelID});
});

Meteor.publish('userPresence', function() {
  // Setup some filter to find the users your user
  // cares about. It's unlikely that you want to publish the
  // presences of _all_ the users in the system.

  // If for example we wanted to publish only logged in users we could apply:
  // filter = { userId: { $exists: true }};
  var filter = { userId: { $exists: true }};

  return Presences.find(filter, { fields: { state: true, userId: true }});
});

Meteor.publish('allUsers', function() {
  return Meteor.users.find({}, {
    fields: {
      _id: 1,
      username: 1
    }
  });
});
