SignalR Hubs & Connections
Create a SignalR hub, map it in ASP.NET Core, and establish WebSocket connections from JavaScript and .NET clients.
What Is SignalR?
SignalR is an ASP.NET Core library that adds real-time, bidirectional communication between server and clients. It automatically picks the best transport — WebSockets, Server-Sent Events, or Long Polling — based on what both sides support.
Setting Up SignalR
Add SignalR to services and map a hub endpoint. A hub is a class that handles client connections and method calls.
builder.Services.AddSignalR();
var app = builder.Build();
app.UseCors("AllowAll");
app.MapHub<ChatHub>("/hubs/chat");
app.Run();All lessons in this course
- SignalR Hubs & Connections
- Groups, Users & Connection Management
- Strongly Typed Hubs
- Scaling with Redis Backplane