From 6c728df4aca27f9995c163fd61a22346ad19b7a4 Mon Sep 17 00:00:00 2001 From: Lucas Morgan Date: Mon, 26 Aug 2024 19:58:28 -0500 Subject: [PATCH] Debug signalr --- Shogi.Api/appsettings.json | 6 +++--- Shogi.UI/Shared/GameHubNode.cs | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Shogi.Api/appsettings.json b/Shogi.Api/appsettings.json index cc40092..1946ca8 100644 --- a/Shogi.Api/appsettings.json +++ b/Shogi.Api/appsettings.json @@ -8,9 +8,9 @@ "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Error", "Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information", - "System.Net.Http.HttpClient": "Error" - //"Microsoft.AspNetCore.SignalR": "Debug", - //"Microsoft.AspNetCore.Http.Connections": "Debug" + "System.Net.Http.HttpClient": "Error", + "Microsoft.AspNetCore.SignalR": "Debug", + "Microsoft.AspNetCore.Http.Connections": "Debug" } }, "ApiKeys": { diff --git a/Shogi.UI/Shared/GameHubNode.cs b/Shogi.UI/Shared/GameHubNode.cs index d78033c..6d78365 100644 --- a/Shogi.UI/Shared/GameHubNode.cs +++ b/Shogi.UI/Shared/GameHubNode.cs @@ -23,6 +23,19 @@ public class GameHubNode : IAsyncDisposable options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets; }) .Build(); + + this.hubConnection.Closed += this.HubConnection_Closed; + } + + private Task HubConnection_Closed(Exception? arg) + { + Console.WriteLine("SignalR connection closed"); + if (arg != null) + { + Console.WriteLine("Because {0}", arg.Message); + } + + return Task.CompletedTask; } public bool IsConnected => this.hubConnection.State == HubConnectionState.Connected;