The Free Software Media System - Server Backend & API
Fix WebSocket disconnecting when exception is thrown during processing (#11395)
Niels van Velzen43569082f944
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.csindex 34dc027f18..cb6f7e1d35 100644--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs@@ -199,13 +199,20 @@ namespace Emby.Server.Implementations.HttpServer}else{- await OnReceive(- new WebSocketMessageInfo- {- MessageType = stub.MessageType,- Data = stub.Data?.ToString(), // Data can be null- Connection = this- }).ConfigureAwait(false);+ try+ {+ await OnReceive(+ new WebSocketMessageInfo+ {+ MessageType = stub.MessageType,+ Data = stub.Data?.ToString(), // Data can be null+ Connection = this+ }).ConfigureAwait(false);+ }+ catch (Exception exception)+ {+ _logger.LogWarning(exception, "Failed to process WebSocket message");+ }}}