What is SignalR?
Answer
SignalR is an ASP.NET Core library that simplifies adding real-time, bidirectional communication between server and clients. It abstracts the transport mechanism — automatically selecting WebSockets (preferred), Server-Sent Events, or Long Polling based on client/server capabilities. Server hub: public class ChatHub : Hub { public async Task SendMessage(string user, string message) { await Clients.All.SendAsync("ReceiveMessage", user, message); } }. Client (JavaScript): const connection = new signalR.HubConnectionBuilder().withUrl("/chatHub").build(); connection.on("ReceiveMessage", (user, msg) => { ... }); await connection.start(); await connection.invoke("SendMessage", "Alice", "Hello!");. Client groups, user-specific messaging, and authentication are all supported. Scale-out with Redis backplane for multi-server deployments. Use cases: chat, live dashboards, collaborative editing, real-time notifications, gaming.
Previous
What is the CQRS pattern in C#?
Next
What is middleware authentication vs authorization in ASP.NET Core?
More C# / .NET Questions
View all →- Intermediate What is ASP.NET Core and how does it differ from ASP.NET Framework?
- Intermediate What is middleware in ASP.NET Core?
- Intermediate What is dependency injection in ASP.NET Core?
- Intermediate What is Entity Framework Core?
- Intermediate What is the difference between eager, lazy, and explicit loading in EF Core?