Get connection on login callback

Quick question: Is it possible, on the server, to get the clients ddp connection object inside the Accounts.onLogin callback? (It’s available in normal meteor methods as this.connection).

Callbacks registered via Accounts.onLogin get passed an internal “login attempt” object. This object has a connection property that should give you what you’re looking for:

if (Meteor.isServer) {
  Accounts.onLogin((attempt) => {
    console.log(attempt.connection);
  });
}
3 Likes

Thanks, I read the documentation at least 3 times before asking, but somehow managed to miss it all 3 times :stuck_out_tongue: