DDP Meteor publish to specific client

Is it possible to make that Meteor.publish method (in server app) notifiy user with specific connection? For example I’m tracking connected users

  Meteor.onConnection(function(connection) {
        console.log(connection.id + ", " + connection.clientAddress);

and here’s how publish method works

 Meteor.publish('test1', function(data){
        return Users.find();

So I just want to notify user with connection.id = ywB9jPmCwguxjasDk if User collection changes. Is it possible to do that? Currently all users are notified if collection changes. Thank you :slight_smile:

Take a look at EventDDP. It’s a pretty old package, but it works just fine even with latest Meteor. It lets you to send event messages to clients and filter them by user ID.

This is very easy (maybe I am missing something)

See docs on this.connection and this.ready() for publish functions.

I am assuming this:

  • All users will get the results of the first call to subscribe('test1…)`
  • Everyone else gets nothing
// Declare UserAccessConnection as global variable
// (or could be local variable if in the same file)
UserAccessConnection = null;
Meteor.onConnection(function(connection) {
  console.log(connection.id + ", " + connection.clientAddress);
  // some logic...
  UserAccessConnection  = connection.id;
 Meteor.publish('test1', function(data){
  let retVal = [];
  if(UserAccessConnection === this.connection.id) {
    retVal = Users.find();
  } else {

  return retVal;

Maybe I am missing some details that make this more complex? Or maybe @henribeck’s advice to read the docs is good too. :neutral_face: