Internative Logo

What Is SignalR? Real-Time Communication for ASP.NET Core

What Is SignalR? Real-Time Communication for ASP.NET Core

A web page normally learns about new data only when it asks for it. That works for forms and reports, but not for a live dashboard, a chat window or an order status that should change the moment the backend changes it. Teams used to solve this with polling, asking the server every few seconds, which wastes requests and still feels slow. SignalR is Microsoft's library for the opposite direction: it keeps a connection open so .NET server code can push updates to connected clients as soon as they happen.

This article explains what SignalR is, how it works, where it fits, where it does not, and how it compares with WebSockets, Socket.IO and managed services.

What is SignalR?

SignalR is an open-source library for adding real-time communication to ASP.NET applications. It handles the connection between server and client, picks the best available transport, and gives you a simple programming model: the server calls methods on clients, and clients call methods on the server.

The project was started in 2011 by David Fowler and Damian Edwards, two engineers on Microsoft's ASP.NET team, and developed in the open on GitHub. SignalR 1.0, the first stable release, shipped on 18 February 2013 as part of the ASP.NET and Web Tools 2012.2 update.

In 2018 Microsoft released a rewritten version, ASP.NET Core SignalR, with ASP.NET Core 2.1. It is the version used in new projects today and lives in the ASP.NET Core repository. It is not compatible with the original ASP.NET SignalR: clients and servers from the two versions cannot talk to each other, so moving an older application means updating both sides.

How SignalR works

Hubs. The core concept is the hub, a server-side class whose public methods clients can call. The hub can also call methods on clients by name, for example ReceiveMessage or OrderUpdated. This remote procedure call (RPC) model means you think in terms of methods and arguments, not raw messages.

Transport negotiation. When a client connects, SignalR negotiates the best transport the client and network support. It prefers WebSockets, falls back to Server-Sent Events, and finally to long polling. Application code stays the same whichever transport is used.

Protocols. Messages are serialised as JSON by default. The MessagePack protocol is available for a smaller, binary format when bandwidth or speed matters.

Connections, users and groups. SignalR tracks every connection. You can send a message to all clients, to one connection, to every connection of a signed-in user, or to a named group such as a project, a chat room or a tenant. Groups are what make multi-tenant notifications simple.

Clients. Official client libraries exist for JavaScript and TypeScript in the browser and Node.js, for .NET (including desktop and mobile apps), and for Java.

Key features

  • Automatic transport fallback from WebSockets to Server-Sent Events and long polling.
  • Hub-based RPC in both directions, with strongly typed hubs in C#.
  • Groups and user targeting for sending updates only to the people who should see them.
  • Streaming from server to client and from client to server, for progress feeds and live data.
  • Authentication and authorisation through the standard ASP.NET Core mechanisms, including cookies and bearer tokens.
  • Automatic reconnection support in the clients.
  • Scale-out options: a Redis backplane for self-hosted servers, or Azure SignalR Service as a managed connection layer.

Where SignalR is used

  • Live dashboards and monitoring screens that show metrics, alerts or device status as they change.
  • Notifications inside business applications: an approval request, a finished report, a new comment.
  • Chat and support windows between customers and agents.
  • Collaborative tools, where several people edit the same record or board and see each other's changes.
  • Progress tracking for long-running jobs such as imports, exports and file processing.
  • Blazor Server, where SignalR carries every UI interaction between the browser and the server. See Blazor.

When to choose SignalR, and when not to

Choose SignalR when:

  • Your backend is ASP.NET Core and you want real-time features without writing a protocol yourself.
  • Updates need to target specific users, roles or tenants rather than every connected client.
  • Some users sit behind proxies or networks where WebSockets may be blocked, and a fallback matters.
  • You want real-time code to share authentication, dependency injection and logging with the rest of the API.

Look elsewhere when:

  • The backend is not .NET. In a Node.js stack, Socket.IO gives a similar model.
  • You only need one-way updates, such as a news feed. Plain Server-Sent Events are simpler and need no client library.
  • You need audio or video between users. That is WebRTC territory, with media servers such as Mediasoup or platforms such as Agora.
  • You do not want to run connection infrastructure at all. A hosted service such as Pusher moves that work outside your servers.

Scaling is the main thing to plan for. When several servers run behind a load balancer, all requests of one SignalR connection must reach the same server unless every client uses WebSockets only, so sticky sessions are usually required. Messages also have to reach clients connected to other servers, which is what the Redis backplane or Azure SignalR Service solves.

SignalR and its alternatives

OptionPlatformModelBest fit
SignalR.NETHubs (RPC), transport fallbackASP.NET Core backends
Socket.IONode.jsEvents, rooms, transport fallbackJavaScript backends
Raw WebSocketAnyMessages you design yourselfSimple or custom protocols
Server-Sent EventsAny HTTP serverOne-way server pushFeeds and notifications
Hosted services (Azure SignalR, Pusher)ManagedPub/sub over a hosted connection layerLarge audiences without running servers

The most common comparison is SignalR vs WebSocket. WebSocket is a protocol; SignalR is a library that uses WebSocket when it can and adds what an application needs on top: fallbacks, reconnection, groups, user targeting and an RPC model. A raw WebSocket is lighter, but you write all of that yourself.

How we use SignalR at Internative

We use SignalR in .NET-based projects that need reliable real-time updates and tight integration with the backend. It fits naturally into Microsoft-centred architectures and scales to enterprise workloads, so live features sit inside the same .NET application, security model and deployment as the rest of the system.

If you are planning a business application with live dashboards, notifications or collaboration features, our enterprise software solutions team can help you decide how real-time communication should fit into it.

Frequently asked questions

Is SignalR better than WebSocket?

They solve different problems. WebSocket is the underlying protocol; SignalR is a library that uses WebSocket by default and adds transport fallback, automatic reconnection, groups, user targeting and a method-call model. If you want those features in an ASP.NET Core application, SignalR saves a lot of code. If you need a minimal custom protocol, a raw WebSocket is enough.

Is SignalR outdated?

No. The original ASP.NET SignalR no longer gets new features, but ASP.NET Core SignalR is part of current ASP.NET Core releases and is actively developed. Blazor Server also depends on it, which keeps it central to the .NET web stack.

What are the limitations of SignalR?

It is built for .NET servers, so other backends need a different tool. Scaling across several servers requires sticky sessions and a backplane such as Redis, or Azure SignalR Service. Each open connection uses server resources. And it does not handle audio or video streams, which need WebRTC.

SignalR or Socket.IO: which should I choose?

Choose by backend. SignalR is the natural option for ASP.NET Core, with C# hubs and .NET authentication built in. Socket.IO is the equivalent for Node.js, with events, rooms and its own protocol. Both fall back when WebSockets are unavailable, and their clients are not interchangeable.

Do I need Azure to use SignalR?

No. SignalR runs on any server that runs ASP.NET Core, on-premise or on any cloud. Azure SignalR Service is an optional managed service that takes over connection handling when you want to scale without running the infrastructure yourself.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.