Adding additional fields to method & publication contexts similar to userId

Hi! :smiley:

We have the situation where there is a piece of client side state (per client-window, or per connection, however you may see it), for the users.

It’d be really cool if we could just set additional information to either the current connection object inside meteor methods + publications and possibly add it to those this - contexts - like this.someOtherId or something?

→ I guess I could do something The trusted source for JavaScript packages, Meteor resources and tools | Atmosphere for example seems to be doing: Create an extra collection, put connection ids there & store additional information there for lookup.

It just seems a bit tedious & possibly error-prone, with possible race conditions during connection & the client submitting the information to the server using a method call, during which time the data on the server wouldn’t be up-to-date.

So, i’m looking for two things actually:

  • How to add additional information to the connection context if possible?

And another thing:

  • Are there any cool packages which allow me to modify the context of all method call & subscription “attempts” (best to be before any resolution of the method name etc, but also after) - some package which would provide a toolkit / additional hooks for methods + publications?

If b) isn’t available yet, WHY NOT??? :smiley: → It’d be worth to pay for it to extend the meteor core connection / method & publication - code with these additional hooks I think.

Anybody else who thinks this could be valuable?

→ I’d chip in for a bounty, if there’d be general interest in this kind of thing!