Reputation: 26909
I need to send updates via SignalR to a users "Friends", not all connected users.
Clients.callbackName()
Sends a message to All Connected Clients. How do I send a message to just a few clients?
Upvotes: 0
Views: 2584
Reputation: 38764
You can specify the connection id or group name. Check out the docs for more info:
http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server
Upvotes: 2
Reputation: 773
To add a client to a specific group...
Groups.Add(Context.ConnectionId, "johnsFriends");
To send a message to that clients group of friends...
Clients["johnsFriends"].addMessage(message);
Then on the client side the "addMessage" method will be invoked for all clients in the group "johnsFriends".
Upvotes: 1