Sending real-time updates from the server using SignalR
Imagine you have an app that shows information from a server, and this information can be updated by other users. How do you get notified when someone else makes a change so you can update the UI? Periodically polling the server for updates is one approach, but it’s not very efficient. This is where SignalR can be a game-changer.
SignalR
SignalR is a library in ASP.NET Core that enables bi-directional communication between a server and its connected clients. It allows servers to push updates to clients instantly, rather than requiring the client to poll the server for updates.
In this recipe, we’ll create an auction-style app where bids are sent from the server and displayed in a list. Bids can come in at any time, and when a new bid arrives, it should automatically show up in the client app. Users can then accept a bid by clicking the Accept button.
Figure 6.10 – Real-time...