Removing a connection from a group
As we just saw, groups are an interesting and useful feature exposed by the Hub API. In the previous recipe, we concentrated on how to add connections to a specific group, but we did not expand on how you can remove them. This will be the subject of this recipe.
It's quite obvious that in order to remove connections from a group, we'll have to add them to it first; however, that part has already been covered by the previous recipe. Here we'll show the code to do both operations in order to deliver a fully working recipe, but we'll indulge in comments only for the removal part. For more details about adding connections to a group, please refer to the previous recipe.
Getting ready
Before proceeding, we create a new empty web application, which we'll call Recipe09
.
How to do it…
We're ready to actually start adding our SignalR bits by performing the following steps:
We need a Hub called
EchoHub
.We then need an OWIN Startup class named
Startup
containing just a...