Learn how SignalR groups make it possible to divide connections into rooms or channels. Explore how groups work at the hub, and how you can use them in your application.
- [Instructor] Broadcasting messages from the hub to all connected clients is useful, but many applications need to segment clients and only send messages to a particular collection or group of clients. SignalR makes this possible with groups. Groups are defined at the hub with a stream name, and they work at the connection level. Adding or removing a particular connection from a group is done by the hub. Any connection can be a member of zero, one, or many groups. With groups defined, the hub can use clients.group instead of clients.all to send a message to only the clients connected to that group.
Groups are a natural fit for applications that need rooms or channels, where users represented by connections can leave or join a channel. You can also use groups to model subscriptions to topics or sources of data. Groups are flexible, and SignalR doesn't put many restrictions on how you use them. You can use groups in any situation where you need to send messages to a subset of connections. I'll show you how to manage groups at the hub next.
- Comparing SignalR to WebSockets
- How SignalR works
- Adding a SignalR hub
- Handling hub and client connection events
- Adding connections to groups
- Adding persistence
- Adding user authentication