Skip to content

Commit 96d0b8d

Browse files
committed
edit pass: signalr-concept-client-negotiation
1 parent feb071a commit 96d0b8d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

articles/azure-signalr/signalr-concept-client-negotiation.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The first request between a client and a server is the negotiation request. When
1616

1717
The response to the `POST [endpoint-base]/negotiate` request contains one of three types of responses:
1818

19-
* A response that contains `connectionId`, which identifies the connection on the server and the list of the transports that the server supports:
19+
* A response that contains `connectionId`, which identifies the connection on the server and the list of transports that the server supports:
2020

2121
```json
2222
{
@@ -41,7 +41,7 @@ The response to the `POST [endpoint-base]/negotiate` request contains one of thr
4141

4242
The payload that this endpoint returns provides the following data:
4343

44-
* The `connectionId` value that the Long Polling and Server-Sent Events transports require to correlate sending and receiving.
44+
* The `connectionId` value is required by the `LongPolling` and `ServerSentEvents` transports to correlate sending and receiving.
4545
* The `negotiateVersion` value is the negotiation protocol version that you use between the server and the client.
4646
* The `availableTransports` list describes the transports that the server supports. For each transport, the payload lists the name of the transport (`transport`) and a list of transfer formats that the transport supports (`transferFormats`).
4747

@@ -72,7 +72,7 @@ The response to the `POST [endpoint-base]/negotiate` request contains one of thr
7272

7373
The payload that this endpoint returns provides the following data:
7474

75-
* The `error` string that gives details about why the negotiation failed.
75+
* The `error` string gives details about why the negotiation failed.
7676

7777
When you use Azure SignalR Service, clients connect to the service instead of the app server. There are three steps to establish persistent connections between the client and Azure SignalR Service:
7878

@@ -92,7 +92,7 @@ When you use Azure SignalR Service, clients connect to the service instead of th
9292
1. After the client receives the redirect response, it uses the URL and access token to connect to SignalR Service. The service then routes the client to the app server.
9393

9494
> [!IMPORTANT]
95-
> In self-hosted SignalR, some users might choose to skip client negotiation when clients support only WebSocket and save the round trip for negotiation. However, when you're working with Azure SignalR Service, clients should always ask a trusted server or a trusted authntication center to build the access token. So _don't_ set `SkipNegotiation` to `true` on the client side. `SkipNegotiation` means clients need to build the access token themselves. This setting brings a security risk that the client could do anything to the service endpoint.
95+
> In self-hosted SignalR, some users might choose to skip client negotiation when clients support only WebSocket and save the round trip for negotiation. However, when you're working with Azure SignalR Service, clients should always ask a trusted server or a trusted authentication center to build the access token. So _don't_ set `SkipNegotiation` to `true` on the client side. `SkipNegotiation` means clients need to build the access token themselves. This setting brings a security risk that the client could do anything to the service endpoint.
9696
9797
## What can you do during negotiation?
9898

@@ -121,7 +121,7 @@ services.AddSignalR().AddAzureSignalR(options =>
121121

122122
When you have multiple app servers, there's no guarantee (by default) that the server that does negotiation and the server that gets the hub invocation are the same. In some cases, you might want to have client state information maintained locally on the app server.
123123

124-
For example, when you're using server-side Blazor, the UI state is maintained at server side. So you want all client requests to go to the same server, including the SignalR connection. Then you need to enable server sticky mode to `Required` during negotiation:
124+
For example, when you're using server-side Blazor, the UI state is maintained at the server side. So you want all client requests to go to the same server, including the SignalR connection. Then you need to enable server sticky mode to `Required` during negotiation:
125125

126126
```cs
127127
services.AddSignalR().AddAzureSignalR(options => {
@@ -131,7 +131,7 @@ services.AddSignalR().AddAzureSignalR(options => {
131131

132132
### Custom routing in multiple endpoints
133133

134-
Another way that you can customize negotiation is in multiple endpoints. Because the app server provides the service URL as the negotiation response, the app server can determine which endpoint to return to clients for load balancing and communication efficiency. That is, you can let the client connect to the nearest service endpoint to save traffic cost.
134+
Another way that you can customize negotiation is in multiple endpoints. Because the app server provides the service URL as the negotiation response, the app server can determine which endpoint to return to clients for load balancing and communication efficiency. That is, you can let the client connect to the nearest service endpoint to save traffic costs.
135135

136136
```cs
137137
// Sample of a custom router
@@ -149,7 +149,7 @@ private class CustomRouter : EndpointRouterDecorator
149149
return null;
150150
}
151151

152-
return endpoints.FirstOrDefault(s => s.Name == endpointName && s.Online) // Get the endpoint with name that matches the incoming request
152+
return endpoints.FirstOrDefault(s => s.Name == endpointName && s.Online) // Get the endpoint with the name that matches the incoming request
153153
?? base.GetNegotiateEndpoint(context, endpoints); // Fall back to the default behavior to randomly select one from primary endpoints, or fall back to secondary when no primary ones are online
154154
}
155155
}
@@ -158,7 +158,7 @@ private class CustomRouter : EndpointRouterDecorator
158158
Also register the router to dependency injection:
159159

160160
```cs
161-
// Sample of configuring multiple endpoints and dependency injection CustomRouter.
161+
// Sample of configuring multiple endpoints and dependency injection
162162
services.AddSingleton(typeof(IEndpointRouter), typeof(CustomRouter));
163163
services.AddSignalR().AddAzureSignalR(
164164
options =>

0 commit comments

Comments
 (0)