The server-side SignalR components center around the so-called Hub. SignalR Hub is equivalent to MVC or Web API controller. It is identical to gRPC (Remote Procedure Calls) service implementation. It’s a class with a collection of methods that SignalR clients will be able to trigger remotely.

We’ll add a basic example of a Hub to our project and register all necessary dependencies. Then, we’ll go through its structure in a little more detail.

Adding SignalR Hub to the project

We’ll follow similar conventions to MVC. As we have Models, Views, and Controllers folders inside the SignalRServer project, we will add another folder and call it Hubs, then we’ll create a LearningHub.cs file inside this folder.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy