Skip to content
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

V12/generic hub #535

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions uSync.BackOffice/Configuration/uSyncSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public class uSyncSettings
/// location of SignalR hub script
/// </summary>
[DefaultValue("")]
[Obsolete("Will remove the option to move the route in v13")]
public string SignalRRoot { get; set; } = string.Empty;

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion uSync.BackOffice/Hubs/uSyncHubRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace uSync.BackOffice.Hubs
{
/// <summary>
/// Handles SignlarR routes for uSync
/// Handles SignalR routes for uSync
/// </summary>
public class uSyncHubRoutes : IAreaRoutes
{
Expand All @@ -33,6 +33,7 @@ public uSyncHubRoutes(
{
_runtimeState = runtimeState;

#pragma warning disable CS0618 // Type or member is obsolete
if (!string.IsNullOrWhiteSpace(uSyncSettings.Value?.SignalRRoot))
{
_umbracoPathSegment = uSyncSettings.Value.SignalRRoot;
Expand All @@ -41,6 +42,7 @@ public uSyncHubRoutes(
{
_umbracoPathSegment = globalSettings.Value.GetUmbracoMvcArea(hostingEnvironment);
}
#pragma warning restore CS0618 // Type or member is obsolete
}

/// <summary>
Expand Down
12 changes: 8 additions & 4 deletions uSync.Backoffice.Assets/App_Plugins/uSync/usync.hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
//////////////

function initHub(callback) {
initializeHub(Umbraco.Sys.ServerVariables.uSync.signalRHub, callback);
}

function initializeHub(url, callback) {

callbacks.push(callback);

Expand All @@ -34,25 +38,25 @@
.then(function () {
while (callbacks.length) {
var cb = callbacks.pop();
hubSetup(cb);
hubSetup(url, cb);
}
starting = false;
});
}
else {
while (callbacks.length) {
var cb = callbacks.pop();
hubSetup(cb);
hubSetup(url, cb);
}
starting = false;
}
}
}

function hubSetup(callback) {
function hubSetup(url, callback) {

$.connection = new signalR.HubConnectionBuilder()
.withUrl(Umbraco.Sys.ServerVariables.uSync.signalRHub)
.withUrl(url)
.withAutomaticReconnect()
.configureLogging(signalR.LogLevel.Warning)
.build();
Expand Down
Loading