You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/aspnet-core-signalr/includes/1-introduction.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,16 @@ ASP.NET Core SignalR is an open-source library that simplifies adding real-time
2
2
3
3
## Example scenario
4
4
5
-
Imagine you're part of a development team that's been asked to update the live app feature of an existing website. The live map is part of an ordering system that lets Contoso Pizza customers track the progress of their orders.
5
+
Imagine you're part of a development team tasked with updating the live map feature of an existing website. The live map is part of an ordering system that lets Contoso Pizza customers track the progress of their orders.
6
6
7
7
The current solution is implemented through client-side polling for order status change updates. This method is less than ideal, because it has the potential to flood the server with requests. Contoso Pizza has been receiving reports of orders that fail to be processed, resulting in a loss of sales and, potentially, loss of repeat customers.
8
8
9
-
The failures that are reported in the logs occur during peak hours of the sales day. When too many customers view the live order map at the same time, the server is overwhelmed with requests and the process fails. In this module, you'll use SignalR to address these concerns.
9
+
The failures that are reported in the logs occur during peak hours of the sales day. When too many customers view the live order map at the same time, the server is overwhelmed with requests and the process fails. In this module, you use SignalR to address these concerns.
10
10
11
-
## What will we be doing?
11
+
## What are you going to do?
12
12
13
-
In this module, you'll learn the common terminology associated with SignalR, what it is, and how it works. You'll learn when SignalR is appropriate to use and when it's not the best solution. Finally, you'll check your knowledge of SignalR by answering a few key questions.
13
+
In this module, you learn the common terminology associated with SignalR, what it is, and how it works. You learn when SignalR is appropriate to use and when it's not the best solution. Finally, you check your knowledge of SignalR by answering a few key questions.
14
14
15
15
## What is the main goal?
16
16
17
-
By the end of this session, you'll be familiar with SignalR terminology. You'll have a fundamental understanding of its capabilities and limitations. With this knowledge, you'll be able to help decide whether SignalR is a viable option for your team.
17
+
By the end of this module, you're familiar with SignalR terminology and have a fundamental understanding of its capabilities and limitations. With this knowledge, you're able to help decide whether SignalR is a viable option for your team.
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/aspnet-core-signalr/includes/2-what-is-signalr.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
All internet-connected applications are composed of servers and clients. Clients rely on servers for data, and their primary mechanism for receiving data is through making Hypertext Transfer Protocol (HTTP) requests. Some client applications require data that changes frequently.
2
2
3
-
ASP.NET Core SignalR provides an API for creating server-to-client remote procedure calls (RPCs). RPCs invoke functions on clients from the server-side .NET Core code. There are several supported platforms, each with its own client SDK. Therefore, the programming language being invoked by RPC calls can vary.
3
+
ASP.NET Core SignalR provides an API for creating server-to-client remote procedure calls (RPCs). RPCs invoke functions on clients from the server-side .NET Core code. There are several supported platforms, each with its own client SDK. Therefore, the programming language that the RPC calls invoke can vary.
4
4
5
-
It's helpful to familiarize yourself with the common terminology that's associated with SignalR. In this unit, you'll learn what SignalR components are required in a server application, versus those in client applications. Additionally, you'll gain an understanding of the various duplex communication mechanisms. SignalR encapsulates multiple real-time protocols, and abstracts away the complexities of each implementation. For more information, see the [ASP.NET Core SignalR](/aspnet/core/signalr/introduction) documentation.
5
+
It's helpful to familiarize yourself with the common terminology associated with SignalR. In this unit, you learn what SignalR components are required in a server application and in client applications. Additionally, you gain an understanding of the various duplex communication mechanisms. SignalR encapsulates multiple real-time protocols, and abstracts away the complexities of each implementation. For more information, see the [ASP.NET Core SignalR](/aspnet/core/signalr/introduction) documentation.
6
6
7
7
The principal terms that are used in SignalR are discussed in the following sections.
8
8
@@ -26,20 +26,20 @@ In SignalR, a *hub* is used to communicate between clients and servers. A hub is
26
26
27
27
#### Protocols
28
28
29
-
The SignalR Protocol is a protocol for a two-way RPC over any [message-based transport](#transports). Either party in the connection can invoke procedures on the other party, and procedures can return zero or more results or an error. SignalR provides two built-in hub protocols:
29
+
The SignalR Protocol is a protocol for a two-way RPC over any message-based transport. Either party in the connection can invoke procedures on the other party, and procedures can return zero or more results or an error. SignalR provides two built-in hub protocols:
30
30
31
-
- A text protocol that's based on JSON, which is the default.
32
-
- A binary protocol that's based on *MessagePack*, which generally creates smaller messages than JSON does.
31
+
- A text protocol based on JSON, which is the default.
32
+
- A binary protocol based on *MessagePack*, which generally creates smaller messages than JSON does.
33
33
34
-
To use the *MessagePack* protocol, both server and client need to opt in to configuring it, and both server and client have to support it. There's a third hub protocol, called *BlazorPack*, but it's used exclusively with Blazor-Server applications. It can't be used *without* the Blazor-Server hosting model. For more information, see the official specification for [SignalR Hub Protocol](https://github.com/dotnet/aspnetcore/blob/068797e16a1bfe66461e15c8a2ffa864369d384d/src/SignalR/docs/specs/HubProtocol.md).
34
+
To use the *MessagePack* protocol, both server and client need to opt in to configuring it, and both server and client have to support it. There's a third hub protocolused exclusively with Blazor-Server applications, called *BlazorPack*. It can't be used *without* the Blazor-Server hosting model. For more information, see the official specification for [SignalR Hub Protocol](https://github.com/dotnet/aspnetcore/blob/068797e16a1bfe66461e15c8a2ffa864369d384d/src/SignalR/docs/specs/HubProtocol.md).
35
35
36
36
#### Users
37
37
38
-
A user in the system acts as an individual, but can also be part of a group. Messages can be sent to [groups](#groups), and all group members are notified. A single user can connect from multiple client applications. For example, the same user can use a mobile device and a web browser and get real-time updates on both at the same time.
38
+
A user in the system acts as an individual, but can also be part of a group. Messages can be sent to groups, and all group members are notified. A single user can connect from multiple client applications. For example, the same user can use a mobile device and a web browser and get real-time updates on both at the same time.
39
39
40
40
#### Groups
41
41
42
-
A group consists of one or more [connections](#connections). The server can create groups, add connections to a group, and remove connections from a group. A group has a specified name, which acts as its unique identifier. Groups serve as a scoping mechanism to help target messages. That is, real-time functionality can only be sent to users within a named group.
42
+
A group consists of one or more connections. The server can create groups, add connections to a group, and remove connections from a group. A group has a specified name, which acts as its unique identifier. Groups serve as a scoping mechanism to help target messages. That is, real-time functionality can only be sent to users within a named group.
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/aspnet-core-signalr/includes/3-how-signalr-works.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## Servers and the `Hub` class
2
2
3
-
The `Hub` class is a SignalR server concept. It's defined within the `Microsoft.AspNetCore.SignalR` namespace and is part of the [Microsoft.AspNetCore.SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR) NuGet package. ASP.NET Core web apps that target the Microsoft.NET.Sdk.Web SDK don't need to add a package reference for SignalR, because it's already available as part of the [shared framework](/aspnet/core/fundamentals/metapackage-app).
3
+
The `Hub` class is a SignalR server conceptdefined within the `Microsoft.AspNetCore.SignalR` namespace that is part of the [Microsoft.AspNetCore.SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR) NuGet package. ASP.NET Core web apps that target the Microsoft.NET.Sdk.Web SDK don't need to add a package reference for SignalR, because it's already available as part of the [shared framework](/aspnet/core/fundamentals/metapackage-app).
4
4
5
5
A `Hub` is exposed through a *route*. For example, the `https://www.contoso-pizza.com/hubs/orders` route could be used to represent an `OrdersHub` implementation. Through the various hub APIs, authors can define methods and events.
6
6
@@ -46,7 +46,7 @@ You fire [events](#events) from either a `Hub` or an `IHubContext` instance. The
46
46
-<xref:Microsoft.AspNetCore.SignalR.IHubContext%602>: A context where `THub` represents a strongly typed generic hub, and `T` represents the corresponding type of client.
47
47
48
48
> [!IMPORTANT]
49
-
> `IHubContext` is for sending notifications to clients. It is *not*used to call methods on the `Hub`.
49
+
> `IHubContext` is used for sending notifications to clients, *not*for calling methods on the `Hub`.
50
50
51
51
#### An example `IHubContext`
52
52
@@ -70,7 +70,7 @@ public sealed class NotificationService(
70
70
}
71
71
```
72
72
73
-
The preceding C# code relies on `IHubContext<NotificationHub>` to access the contextual listing of clients, exposing the ability to broadcast notifications. The `hubContext` primary constructor parameter that's captured in scope is used to fire the `"NotificationReceived"` event, but it isn't intended to be used to call the hub's `NotifyAll` method.
73
+
The preceding C# code relies on `IHubContext<NotificationHub>` to access the contextual listing of clients, exposing the ability to broadcast notifications. The `hubContext` primary constructor parameter is captured in scope and used to fire the `"NotificationReceived"` event, but it isn't intended to be used to call the hub's `NotifyAll` method.
74
74
75
75
### Methods
76
76
@@ -84,7 +84,7 @@ Methods aren't required to fire events, but they often do.
84
84
85
85
### Events
86
86
87
-
An event can be subscribed to by name from a client. The server is responsible for raising events. `Hub`, `Hub<T>`, `IHubContext<THub>`, and `IHubContext<THub, T>` events are *named* and can define up to 10 parameters. Events are fired on the server and handled by interested clients. A client is considered interested when it subscribes to events on its hub's connection. Clients can indirectly trigger events when they call hub methods that fire events as a result of their invocation. Events can't be directly triggered by clients, though, because that's the responsibility of the server.
87
+
The server is responsible for raising events. A client can subscribe to an event by name. `Hub`, `Hub<T>`, `IHubContext<THub>`, and `IHubContext<THub, T>` events are *named* and can define up to 10 parameters. Events are fired on the server and handled by interested clients. A client is considered interested when it subscribes to events on its hub's connection. Clients can indirectly trigger events when they call hub methods that fire events as a result of their invocation. Clients can't directly trigger events, though, because that's the responsibility of the server.
88
88
89
89
#### Event client scopes
90
90
@@ -124,13 +124,13 @@ Consider the following images, which can help you visualize how the hub sends me
:::image type="content" source="../media/signalr-user.png" lightbox="../media/signalr-user-large.png" alt-text="ASP.NET Core SignalR hub sending a message with Clients.User syntax.":::
134
134
135
135
A single user receives this message, regardless of how many devices they're currently using.
136
136
@@ -142,9 +142,9 @@ Consider the following images, which can help you visualize how the hub sends me
142
142
143
143
## Clients and the `HubConnection` class
144
144
145
-
The `HubConnection` class is a SignalR client concept, which represents the client's connection to the [server `Hub`](#servers-and-the-hub-class). It's defined within the `Microsoft.AspNetCore.SignalR.Client` namespace, and it's part of the [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client) NuGet package.
145
+
The `HubConnection` class is a SignalR client concept, which represents the client's connection to the [server `Hub`](#servers-and-the-hub-class). The class is defined within the `Microsoft.AspNetCore.SignalR.Client` namespace, and it's part of the [Microsoft.AspNetCore.SignalR.Client](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client) NuGet package.
146
146
147
-
You create a `HubConnection` by using the builder pattern and the corresponding `HubConnectionBuilder` type. Given the hub's route (or <xref:System.Uri?displayProperty=fullName>), you can create a `HubConnection`. The builder can also specify additional configuration options, including logging, the desired protocol, authentication token forwarding, and automatic reconnection, among others.
147
+
You create a `HubConnection` by using the builder pattern and the corresponding `HubConnectionBuilder` type. Given the hub's route (or <xref:System.Uri?displayProperty=fullName>), you can create a `HubConnection`. The builder can also specify more configuration options. Including, logging, the desired protocol, authentication token forwarding, and automatic reconnection, among others.
148
148
149
149
The `HubConnection` API exposes start and stop functions, which you use to start and stop the connection to the server. Additionally, there are capabilities for streaming, calling [hub methods](#methods), and subscribing to [events](#events).
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/aspnet-core-signalr/includes/4-when-to-use-signalr.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Knowing when *not* to choose SignalR is as important as knowing when to choose i
8
8
9
9
SignalR is only as durable as its underlying connection. That is, if there's cause for concern with the *connectivity* of a client application, SignalR isn't the best choice.
10
10
11
-
Another consideration is the scalability of SignalR. Depending on the number of concurrently connected clients, your web server could experience *resource contention* when it reaches its limits. In situations like this, you would likely need to deploy the application to a server farm and use a backplane. Implementing this on your own can be tedious.
11
+
Another consideration is the scalability of SignalR. Depending on the number of concurrently connected clients, your web server could experience *resource contention* when it reaches its limits. In situations like this, you would likely need to deploy the application to a server farm and use a backplane. Implementing this solution on your own can be tedious.
12
12
13
13
Alternatively, you could resolve this problem by using the [Azure SignalR Service](/azure/azure-signalr). Or you could help alleviate it by taking advantage of various [resiliency and disaster recovery](/azure/azure-signalr/signalr-concept-disaster-recovery) mechanisms.
0 commit comments