Register PreviewHub in composer
It actually updates now \o/
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.SignalR
|
||||
{
|
||||
@@ -7,7 +8,7 @@ namespace Umbraco.Web.BackOffice.SignalR
|
||||
// define methods implemented by client
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
void refreshed(int id);
|
||||
Task refreshed(int id);
|
||||
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Umbraco.Web.BackOffice.SignalR
|
||||
ContentCacheRefresher.CacheUpdated -= HandleCacheUpdated;
|
||||
}
|
||||
|
||||
private void HandleCacheUpdated(ContentCacheRefresher sender, CacheRefresherEventArgs args)
|
||||
private async void HandleCacheUpdated(ContentCacheRefresher sender, CacheRefresherEventArgs args)
|
||||
{
|
||||
if (args.MessageType != MessageType.RefreshByPayload) return;
|
||||
var payloads = (ContentCacheRefresher.JsonPayload[])args.MessageObject;
|
||||
@@ -41,7 +41,7 @@ namespace Umbraco.Web.BackOffice.SignalR
|
||||
foreach (var payload in payloads)
|
||||
{
|
||||
var id = payload.Id; // keep it simple for now, ignore ChangeTypes
|
||||
hubContextInstance.Clients.All.refreshed(id);
|
||||
await hubContextInstance.Clients.All.refreshed(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
src/Umbraco.Web.BackOffice/SignalR/PreviewHubComposer.cs
Normal file
17
src/Umbraco.Web.BackOffice/SignalR/PreviewHubComposer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.BackOffice.SignalR;
|
||||
|
||||
namespace Umbraco.Web.SignalR
|
||||
{
|
||||
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
|
||||
public class PreviewHubComposer : ComponentComposer<PreviewHubComponent>, ICoreComposer
|
||||
{
|
||||
public override void Compose(Composition composition)
|
||||
{
|
||||
base.Compose(composition);
|
||||
|
||||
// composition.RegisterUnique(_ => GlobalHost.ConnectionManager.GetHubContext<PreviewHub, IPreviewHub>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.services'])
|
||||
|
||||
.controller("previewController", function ($scope, $window, $location) {
|
||||
.controller("previewController", function ($scope, $window, $location, umbRequestHelper) {
|
||||
|
||||
$scope.currentCulture = { iso: '', title: '...', icon: 'icon-loading' }
|
||||
var cultures = [];
|
||||
@@ -46,7 +46,8 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
function configureSignalR(iframe) {
|
||||
// signalr hub
|
||||
var previewHub = new signalR.HubConnectionBuilder()
|
||||
.withUrl("/umbraco/previewHub")
|
||||
.withUrl("/umbraco/PreviewHub")
|
||||
.withAutomaticReconnect()
|
||||
.build();
|
||||
|
||||
// visibility tracking
|
||||
|
||||
Reference in New Issue
Block a user