Active publications on server

Is it possible to get list of active publications that server is tracking ?

You should probably look for subscriptions not publications, you could try this,
This is just a quick method to iterate over the active sessions on the server and grab the active subscriptions for each.

Would normally use filter/reduce/map, just made this quickly. This is only going to provide a one time list. There is another object called _universalSubs, which are the publications that automatically get sent to all clients. The _name key is the name of the publication.

Meteor.methods({
  getCurrentDetails () {
    this.unblock()
    const sessions = []
    _.each(Meteor.server.sessions, doc => {
      doc._namedSubs && _.each(doc._namedSubs, sub => {
        if (sub._ready) {
          sessions.push({
            name: sub._name,
            userId: sub.userId,
            connectionId: sub.connection.id,
            subId: sub._subscriptionId,
            // these 2 keys are heavier, but can show the params the publication was passed and the document ids returned. 
            params: sub._params,
            documents: sub._documents
          })
        }
      })
    })
    return sessions
  }
})
1 Like

Thank you. Exactly what I was looking for.
Where can I find more information ? Is Meteor.server and Meteor.server.session documented anywhere ?
Google search for Meteor.server displays only server hostings.