
Discover how SignalR enables two-way client-server communication in ASP.NET Core, handles JSON serialization, and auto-selects transports such as WebSockets or server-sent events for easy scaling across instances.
Discover how ASP.NET Core SignalR enables persistent two-way communication via transport mechanisms like WebSockets, server-sent events, and long polling, with automatic or explicit transport selection.
Open Visual Studio 2017, create an ASP.NET Core web application, add SignalR dependencies, implement a LearningHub that broadcasts messages, and register the hub with services.AddSignalR and app.UseSignalR at /learningHub.
Explore how the LearningHub class models a SignalR Hub, inheriting from the abstract Hub class to enable remote method calls and manage connections via the Context, Clients, and Groups properties.
Explore how a SignalR hub broadcasts messages, handles calls to the caller or others, and manages groups, with connection events and strongly typed, json-serialized client calls.
Define a strongly typed hub by using a client interface, replacing SendAsync with ReceiveMessage for compiler-checked calls. Update the interface when client methods change, but benefits outweigh drawbacks.
Connect to the service side of SignalR by exploring JavaScript, Java, and .NET clients, tailored for .NET developers, with links to additional Java client resources.
Install the SignalR JavaScript client with npm in Visual Studio 2017, then copy signalr and signalr.min to wwwroot/lib/signalr. Update the layout to reference SignalR before site.js for proper client loading.
Show how the JavaScript SignalR client initializes the hub, wires events to hub methods, and demonstrates broadcast, send to self, send to others, and group messaging with automatic reconnection.
Set up a .NET SignalR client in a console app by adding a new console app project named SignalRClient to the solution and installing the SignalR client NuGet package.
Explain configuring a .NET SignalR client with the hub url and transport, bind a C# method to hub messages, and connect to learningHub to send to self or others.
Create a console app named WebSocketsClient to connect a plain WebSockets client to a SignalR hub for legacy systems. Configure it as a startup project and set SignalRClient to None.
Explain building a .NET WebSockets client for a SignalR hub, including WS/WSS URL setup, handshake, and message listening. Describe decoding buffers, filtering heartbeats, and interpreting JSON messages.
Explore SignalR security in a nutshell, learn how to restrict origins and authenticate and authorize users, building on hub, server, and client fundamentals.
Explain CORS in ASP.NET Core, two policies: allow any get and a policy from example.com, and the middleware order before SignalR to support websockets.
Set up authentication in an ASP.NET Core app by registering in middleware, scaffolding Identity, generating the database schema, and updating the layout to enable user login.
Demonstrate ASP.NET Identity's authentication and authorization via the Authorize attribute, roles, and policies, with examples on registering users and restricting actions like broadcast messages.
ConfigureServices adds IdentityOptions and cookie authentication to enable authentication, and UseAuthentication must precede UseSignalR and UseMvc in the pipeline, as shown by registering and logging in to authorize hub methods.
Implement per-user groups in ASP.NET Core SignalR to send messages to individual authenticated users, update hub methods, and prepend usernames to messages.
scale out the SignalR hub by running multiple hub instances behind a load balancer, with a backplane enabled by Redis to synchronize client and group state.
Redis acts as an in-memory database, cache, and message broker for SignalR backplane scaling. Hubs publish and subscribe via Redis, routing messages to clients across multiple hubs.
Connect a SignalR hub to Redis by installing the NuGet package, configuring AddRedis with your Redis connection string, and enabling a backplane to scale out across multiple hub instances.
Move the SignalR hub to a class library and reference it from a second web app, then share the same Redis backplane to treat both apps as one hub.
Explain how IHubContext lets external code access a hub's Clients, Context, and Groups to broadcast messages via a Redis backplane, enabling scalable, simplified cross-app messaging.
Configure a distributed asp.net core app to use an Azure SignalR resource by adding the Microsoft.Azure.SignalR NuGet package to one project, allowing the dependency to implicitly propagate to both projects.
Replace addredis with Azure SignalR Service configuration and use rest api calls to post to the learningHub, sending a payload with target and arguments and checking the response code.
You now know how to use SignalR and can build your own application with ASP.NET Core, exploring server-side Blazor and other features to integrate SignalR in various app types.
Are you a web developer? If so, you would know that many web development projects these days require the ability to establish a persistent connection between a client and a server without having to keep sending repeated requests from the client. As you may also know, such functionality may be hard to implement.
However, if you can build your web application in ASP.NET Core, there is a way to make this whole process easy. There is a library called SignalR. This is what I'm going to talk about in this course. As well as doing all the heavy lifting for you, the library abstracts away all complex implementation details, so your code can be made extremely simple.
However, as you would already know, nothing in programming is simple in absolute terms. Programming is a complex activity, so even those concepts that are relatively simple require some practice and studying.
This is why I've created this course. By the end of it, you should be able to build a web application that clients will be able to establish a persistent connection with and exchange the data with in real time.