⚙️ C# / .NET Intermediate

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.