From c5d8a8d07fe01b9ad6bb4cf885ca6de510b079dc Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 7 Oct 2025 17:54:58 +0800 Subject: [PATCH] :mute: Mute ungraceful closed websocket --- DysonNetwork.Ring/Connection/WebSocketController.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Ring/Connection/WebSocketController.cs b/DysonNetwork.Ring/Connection/WebSocketController.cs index 4e1eeac..5fc710c 100644 --- a/DysonNetwork.Ring/Connection/WebSocketController.cs +++ b/DysonNetwork.Ring/Connection/WebSocketController.cs @@ -84,6 +84,15 @@ public class WebSocketController( { await _ConnectionEventLoop(deviceId, currentUser, webSocket, cts.Token); } + catch (WebSocketException ex) when (ex.Message.Contains("The remote party closed the WebSocket connection without completing the close handshake")) + { + logger.LogDebug( + "WebSocket disconnected with user @{UserName}#{UserId} and device #{DeviceId} - client closed connection without proper handshake", + currentUser.Name, + currentUser.Id, + deviceId + ); + } catch (Exception ex) { logger.LogError(ex, @@ -152,4 +161,4 @@ public class WebSocketController( } } } -} \ No newline at end of file +}