aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2024-04-21 18:54:42 +0200
committerGitHub <noreply@github.com>2024-04-21 10:54:42 -0600
commit43569082f9447413ce42cb251fbe528133a9837c (patch)
treef8d2c5e4e23adf9f916c171cedd9e7d832498c1a /Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
parente42325883fc800f88867ef31eb839812a9644d4d (diff)
Fix WebSocket disconnecting when exception is thrown during processing (#11395)
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/WebSocketConnection.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/WebSocketConnection.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
index 34dc027f1..cb6f7e1d3 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");
+ }
}
}