liveBook · Manning

ASP.NET Core SignalR

As explained in Building Distributed Applications that Work

SignalR is a .NET library for real-time web communication between clients and servers, including bidirectional message delivery.

ASP.NET Core SignalR provides two-way, real-time communication between a server and connected clients. A server can push an update as it happens instead of waiting for a client to poll. Hubs provide a higher-level way for each side to call methods on the other. section 4.1

SignalR normally uses WebSockets. If that transport is unavailable, it can fall back to server-sent events or long polling. For applications spread across servers, backplanes such as Redis, Azure SignalR Service, and SQL Server can deliver updates to clients regardless of which server holds their connection. section 4.1

builder.Services.AddSignalR();

Register SignalR’s services in the API project’s Program.cs before configuring the hub endpoint. section 4.3.2

app.MapHub<LocationHub>("/locationHub");

Map the location hub to an HTTP path before app.Run(); clients use that path to reach the hub. section 4.3.2

Live order location

A user interface stays connected to the backend and receives updated locations for a marker on an OpenLayers map. In Blazor, interactive rendering and JavaScript interop support the map updates; UI updates from Blazor must wait until the Razor component has rendered. section 4.5

The same real-time channel can support a custom chat interface that streams an LLM answer as it arrives. section 5.4

How Building Distributed Applications that Work covers it

How deep it goes
Defines transports and hub RPCs, then shows service registration and endpoint mapping; stops short of detailing hub implementation in the supplied excerpts.
Examples
Uses an OpenLayers order-location marker and a custom chat interface that streams LLM answers.
What it assumes
Introduces SignalR from its basic purpose while using ASP.NET Core service registration and endpoint mapping for setup.
What you can do after
Apply it via ASP.NET Core SignalR to register and map a hub for real-time client updates.
How it connects
Connects WebSockets, server-sent events, long polling, hub RPCs, scale-out backplanes, and Blazor JavaScript interop.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.