SignalR on .NET 6 - the Complete Guide: The easiest way to enable real-time two-way HTTP communication on .NET 6
Book information
Description
Are you a web developer or do you write Internet of things (IoT) software? If so, you would know that many web and IoT 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. For example, a user of a live chat would want to know in real time that they have received a new message. Or an IoT device may need to be sent a command in real time. As you may also know, such functionality may be hard to implement. However, if you can build your server-side application on ASP.NET Core, there is a way to make this whole process easy. There is a library called SignalR, which is included in ASP.NET Core. SignalR doesn't only enable you to achieve real-time two-way communication between applications. It also substantially simplifies the process of enabling all of this in the code. Under the hood, it uses various two-way communication protocols, such as WebSocket. However, it abstracts away all the implementation complexity of these protocols. To the developer, working with this library will mostly consists of writing simple and easily readable statements. In this book, we will cover everything you would need to know about using SignalR on .NET 6, so you will see how to integrate it with the the latest features on ASP.NET Core 6 and C# 10. We will cover much more than you can find in the official documentation of the library. For example, you will learn how to connect a plain WebSocket client to it, which may help you to write a client in a language that isn't officially supported. Likewise, we will cover many concepts that aren't directly related to SignalR, but are important to its production-ready implementation. These would include single sign-on, certificate authorization, logging, metrics and scaling out. By the end of this book, you would be able to identify the situations where SignalR is the best tool for the job and you would be fully capable to implement it. Table of Contents 1 - Introduction to SignalR What makes SignalR so great Example use cases for SignalR Who is this book for The scope of this book Prerequisites How to use this book Book structure About the author Getting touch with the author 2 - Setting up your project Prerequisites Setting up your environment Setting up SignalR hub Making SignalR hub strongly-typed Summary Test yourself Further reading 3 - In-browser SignalR clients Prerequisites Setting up JavaScript client Setting up Blazor WebAssembly client Summary Test yourself Further reading 4 - External SignalR clients Prerequisites Setting up .NET client Setting up Java client Setting up a raw WebSocket client Summary Test yourself Further reading 5 - Sending messages to individual clients or groups of clients Prerequisites Broadcasting messages to all clients Sending messages to specific clients Working with client groups Summary Test yourself Further reading 6 - Streaming in SignalR Prerequisites What is streaming used for Client streaming in SignalR Server streaming in SignalR Summary Test yourself Further reading 7 - Advanced SignalR configuration Prerequisites Configuring SignalR server Configuring SignalR client Pros and cons of MessagePack protocol Summary Test yourself Further reading 8 - Securing your SignalR applications Prerequisites What is CORS and why it's important Setting up single sign-on provider Applying authentication in SignalR Applying authorization in SignalR Summary Test yourself Further reading 9 - Scaling out SignalR application Prerequisites Setting up Redis backplane Running multiple hub instances via Redis backplane Using HubContext to send messages from outside SignalR hub Summary Test yourself Further reading 10 - Introducing Azure SignalR Service Prerequisites Setting up Azure SignalR Service Adding Azure SignalR Service dependencies to your application Overview of Azure SignalR Service REST API Summary Test yourself Further reading Wrapping up Answers to self-assessment questions Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10
Similar books
Machine Learning for C# Developers
2025 · EPUB
SignalR on .NET 6 - the Complete Guide: The easiest way to enable real-time two-way HTTP communication on .NET 6
EPUB
Implementing C# 11 and .NET 7.0: Learn how to build cross-platform apps with .NET Core
2023 · EPUB
The easiest way to learn design patterns With C# code samples using .NET 6 templates
2022 · PDF
The easiest way to learn design patterns: With C# code samples using .NET 6 templates
2022 · EPUB
The easiest way to learn design patterns: With C# code samples using .NET 6 templates
2022 · PDF
SignalR on .NET 6 - the Complete Guide: The easiest way to enable real-time two-way HTTP communication on .NET 6
2022 · EPUB
Microservices Communication in .NET Using gRPC: A practical guide for .NET developers to build efficient communication mechanism for distributed apps
2022 · PDF