Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ private void AuthenticationStateChanged(Task<AuthenticationState> task)
//#if (signalR == true)
private void SubscribeToSignalREventsMessages()
{
hubConnection.Remove(SignalREvents.SHOW_MESSAGE);
signalROnDisposables.Add(hubConnection.On<string, Dictionary<string, string?>?, bool>(SignalREvents.SHOW_MESSAGE, async (message, data) =>
{
logger.LogInformation("SignalR Message {Message} received from server to show.", message);
Expand Down Expand Up @@ -209,17 +210,20 @@ private void SubscribeToSignalREventsMessages()
// You can also leverage IPubSubService to notify other components in the application.
}));

hubConnection.Remove(SignalREvents.PUBLISH_MESSAGE);
signalROnDisposables.Add(hubConnection.On<string, object?>(SignalREvents.PUBLISH_MESSAGE, async (message, payload) =>
{
logger.LogInformation("SignalR Message {Message} received from server to publish.", message);
PubSubService.Publish(message, payload);
}));

hubConnection.Remove(SignalREvents.EXCEPTION_THROWN);
signalROnDisposables.Add(hubConnection.On<AppProblemDetails>(SignalREvents.EXCEPTION_THROWN, async (appProblemDetails) =>
{
ExceptionHandler.Handle(appProblemDetails, displayKind: ExceptionDisplayKind.NonInterrupting);
}));

hubConnection.Remove(SignalRMethods.UPLOAD_DIAGNOSTIC_LOGGER_STORE);
signalROnDisposables.Add(hubConnection.On(SignalRMethods.UPLOAD_DIAGNOSTIC_LOGGER_STORE, async () =>
{
return DiagnosticLogger.Store.ToArray();
Expand Down Expand Up @@ -308,8 +312,6 @@ await storageService.GetItem("Culture") ?? // 2- User settings
private List<IDisposable> signalROnDisposables = [];
protected override async ValueTask DisposeAsync(bool disposing)
{
await base.DisposeAsync(disposing);

unsubscribe?.Invoke();

NavigationManager.LocationChanged -= NavigationManager_LocationChanged;
Expand All @@ -320,6 +322,9 @@ protected override async ValueTask DisposeAsync(bool disposing)
hubConnection.Reconnected -= HubConnectionConnected;
hubConnection.Reconnecting -= HubConnectionStateChange;
signalROnDisposables.ForEach(d => d.Dispose());
signalROnDisposables = [];
//#endif

await base.DisposeAsync(disposing);
}
}
Loading