-
Notifications
You must be signed in to change notification settings - Fork 2.9k
SignalR: Add configurable transport settings for load-balanced deployments without sticky sessions #22700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
SignalR: Add configurable transport settings for load-balanced deployments without sticky sessions #22700
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0a6050d
WIP
Migaroez f384f35
Cleanup and type generation
Migaroez b61eb92
Improve obsoletions
Migaroez 095fd5c
Fix removed constructor
Migaroez 73345f0
Simplify logic because of SignalR's JS limitations
Migaroez aa82d43
Apply suggestions from code review
Migaroez 54909dd
Add SignalRSettings to Schema
Migaroez 6adf47b
Abstrack SignalRRoutes class
Migaroez dbf011d
Fix bool to observable<bool>
Migaroez b570385
Refactor base class: pull down common service property, make abstract…
AndyButland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Umbraco.Cms.Api.Management/ViewModels/Server/SignalRClientSettingsResponseModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace Umbraco.Cms.Api.Management.ViewModels.Server; | ||
|
|
||
| /// <summary> | ||
| /// Represents client-side SignalR settings returned by the server configuration endpoint. | ||
| /// </summary> | ||
| public class SignalRClientSettingsResponseModel | ||
| { | ||
| /// <summary>Gets or sets a value indicating whether the client should skip the SignalR negotiate round-trip.</summary> | ||
| public bool SkipNegotiation { get; set; } | ||
| } |
|
Migaroez marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using System.ComponentModel; | ||
|
|
||
| namespace Umbraco.Cms.Core.Configuration.Models; | ||
|
|
||
| /// <summary> | ||
| /// Typed configuration options for SignalR settings. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// When <see cref="ClientShouldSkipNegotiation"/> is enabled, all hub endpoints are restricted | ||
| /// to WebSocket transport and the client skips the negotiate round-trip. The setting is forwarded | ||
| /// to the client via the <c>/umbraco/management/api/v1/server/configuration</c> endpoint. | ||
| /// </para> | ||
| /// <para> | ||
| /// Downstream packages (e.g. Umbraco Cloud) can configure these settings via | ||
| /// <c>IConfigureOptions<SignalRSettings></c> or <c>appsettings.json</c> | ||
| /// under <c>Umbraco:CMS:SignalR</c>. | ||
| /// </para> | ||
| /// </remarks> | ||
| [UmbracoOptions(Constants.Configuration.ConfigSignalR)] | ||
| public class SignalRSettings | ||
| { | ||
| internal const bool StaticClientShouldSkipNegotiation = false; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a value indicating whether the client should skip the SignalR negotiate | ||
| /// round-trip and connect directly via WebSockets. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// When <c>true</c>, the server restricts all hub endpoints to the WebSocket transport only | ||
| /// (via <c>HttpConnectionDispatcherOptions.Transports</c>) and the client is instructed to | ||
| /// set <c>skipNegotiation = true</c> with <c>transport = WebSockets</c>. This eliminates the | ||
| /// negotiate HTTP request that causes failures in load-balanced deployments without sticky sessions. | ||
| /// This is safe for self-hosted SignalR but must <b>not</b> be used with Azure SignalR Service. | ||
| /// </remarks> | ||
| [DefaultValue(StaticClientShouldSkipNegotiation)] | ||
| public bool ClientShouldSkipNegotiation { get; set; } = StaticClientShouldSkipNegotiation; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.