Fix WebSocket disconnecting when exception is thrown during processing (#11395)

This commit is contained in:
Niels van Velzen 2024-04-21 18:54:42 +02:00 committed by GitHub
parent e42325883f
commit 43569082f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");
}
}
}