Operations in the Hub class
On the server we're going to do a series of operations through the hub class, so let's talk about what we can do.
Send Message operation for client
Call the Helloclient method for all clients
Clients.All.helloClient ();
Call the Helloclient method for all clients except for a given ConnectionID client
Clients.allexcept (Context.connectionid). Helloclient ();
Invokes the Helloclient method of the specified ConnectionID client
Clients.client (Context.connectionid). Helloclient ();
Calls the Helloclient method to the client of the specified ConnectionID collection
Clients.clients (New list<string> () {"Client1", "Client2"}). Helloclient ();
Invokes all client helloclient methods in a group with the specified name, this method has overloads and can specify the excluded ConnectionID
Clients.group ("Room1"). Helloclient ();
Invokes the Helloclient method for all clients of the specified group collection, which has overloads that can specify the excluded ConnectionID
Clients.groups (New list<string> () {"Room1", "Room2"}). Helloclient ();
Group operations
Remember that in a persistent connection class, you can add members to a group and delete members, which you can do in a hub.
Add action
Groups.add (this. Context.connectionid, "room1");
Delete operation
Groups.remove (this. Context.connectionid, "room1");
Note: User and users in clients are not explained because they are related to authentication and are left to the post for further explanation.
An explanation of the operations in the ASP. NET SignalR Hub class