Finding all the clients of a group

48 views Asked by At

I am using SignalR in my application.

In order to add or remove clients to a Group we use this API

Clients.Group.Add(clientID, groupname)

This is working fine.

My goal is to get the reverse of it i.e

I need to get all the clients of that group. I need to apply foreach on it and perform some operation in database.

Is there any API for finding all the clients of a group?

2

There are 2 answers

0
Nasreddine On

It's not possible. You'll have to manage groups manually if you want this functionality.

There is no API for getting a group membership list or a list of groups. SignalR sends messages to clients and groups based on a pub/sub model, and the server does not maintain lists of groups or group memberships.

Taken from here. There are also examples on the same page on how to implement groups using a database server or Azure table storage.

0
NickT On

This link shows how to add groups members to a database. You must override the Task OnConnected event handler. Once you do that, you should be able to do whatever else you need in the database. http://www.asp.net/signalr/overview/guide-to-the-api/working-with-groups