-
Notifications
You must be signed in to change notification settings - Fork 16
Description
In my app, Users have different "roles" within an Organization. I will want to send some messages to Users/connections of all "roles", while other messages should only be sent to Users/connections with a "role" that's >= to a specific role.
When Users connect, I'm adding them to a room that is a combination of their Organization ID + their role within it, e.g. <orgId>:<role>, e.g. ORG1234:admin.
I have 2 questions:
-
In this scenario, is there a way to send a message to all Users on an Org, regardless of their role? I would think something like
primus.in('ORG1234:*').except(<filter_rooms>).send('update', data)would work, but it does not appear to work. It seems like things work in the opposite direction: a User/connection must join roomORG1234:*and a call likeprimus.in('ORG1234:admin').except(<filter_rooms>).send('update', data)would reach them. This seems backwards to me. Is this the case or am I missing something? -
(This is less expected to work, but along the same vein:) Let's say that I change the string of
adminto a value like1, so in my above example a User would connect toORG1234:1. Is there a way to send messages to Users/connections that are in<=2for the "role" part? E.g.primus.in('ORG1234:<=2').except(<filter_rooms>).send('update', data)? Or do I have to create all the room IDs into an array and use them likeprimus.in(['ORG1234:1', 'ORG1234:2']).except(<filter_rooms>).send('update', data)?
Thanks for any help!