From the course: Building Real-Time Web Apps with SignalR 2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

How SignalR groups work

How SignalR groups work

From the course: Building Real-Time Web Apps with SignalR 2

Start my 1-month free trial

How SignalR groups work

- [Instructor] SignalR provides a few useful tools to help you hub manage its connected users and gives you the power to deliver messages to any set of users you can imagine. The way SignalR enables you to do this is through a feature called Groups. Groups give you more power over how to broadcast messages to certain cross-sections of connected clients. A group can contain any number of clients and a client can be a member of multiple groups. Groups are also dynamic which means you can define them on the fly without having to worry about creating them up front. Groups are very powerful and they boil down to a few, simple operations. You can add a client to a group, remove a client from a group, and you can broadcast a message to users in a group. Let's take a quick look at how you can do that with the next example. We'll look at this first method here in our sample ChatHub in the JoinRoom method. It's as simple as calling Groups.Add. You pass in the ID of a connected client followed…

Contents