I’m studying SingalR(https://github.com/SignalR/SignalR).
I’m really want to send a message to all connection except the person who makes a event.
For example,
In Chatting application, there is three client(A,B,C).
Client A type a message, “Hello” and clikc submit.
Clients.addMessage(data); send “Hello” to All Cleint(include cleint A)
I want to send “Hello” only Client B and C.
How can I achieve it?
// I think this can get all Clients, right?
var clients = Hub.GetClients<Chat>();
There’s no way to filter message on the server today, but you can block messages to the caller from the client side. If you look at some of the samples on signalr, you’ll see that they assign each client a generated id to the client in a method (usually called join). Whenever you invoke a method from the hub, pass the id of the calling client, then on the client side do a check to make sure the id of the client isn’t the same as the caller. e.g.
Client side
Hope that helps.