JP.
JP.

Reputation: 5606

SignalR - connection/user subgroups

I am using signalr for the first time to broadcast communications concurrently to groups of users. I have two regions - US and Canada and multiple applications sales/marketing/etc.

I would like to be able to send messages to:

Right now I can send messages to a specific group - essentially accomplishing #1 and #2 above. Is it possible to have sub groups of users - or only send messages if a user is currently assigned to both groups? If not, is there a best practice for achieving this functionality?

Thanks JP

Upvotes: 0

Views: 944

Answers (2)

N. Taylor Mullen
N. Taylor Mullen

Reputation: 18301

No you are not able to do this out of the box.

You could however try and query the users who do NOT fit your criteria and then include them in the "Exclude connection Id" parameter in your group.send request.

So for instance (sudo code)

var exclusionIds = myusers.Where(u => u.OnApplication("App1")).Where(x => !x.InRegion("xyz")).Select(z => z.ConnectionId).ToArray();

Clients.Group("App1", exclusionIds).foo();

Upvotes: 4

Abhishek Nanda
Abhishek Nanda

Reputation: 1007

SignalR only provides the functionality that helps you maintain simple groups. You'll have to handle your subgroup logic in your code. You can create 'sets' for the different groups and send messages to the intersection of these groups/sets as needed. You can take a look at the chat sample in SignalR to find out more about how to manage groups in your application.

Upvotes: 2

Related Questions