How to change DDP userId?

I creating custom accounts package and i need to set userId of DDP connection after login successful.

I using this method to do that:


But i can’t use it in publishcation methods:

Meteor.publish('jobs', function(options){
    console.log(this.userId); // <= NULL

Anyone can help me?

1 Like

You have to call this.setUserId on server. See:

1 Like

Thankyou so much. Solved !