diff --git a/JL.Core/Network/WebSocketUtils.cs b/JL.Core/Network/WebSocketUtils.cs index 811c5586..abb580ac 100644 --- a/JL.Core/Network/WebSocketUtils.cs +++ b/JL.Core/Network/WebSocketUtils.cs @@ -46,7 +46,9 @@ private static void ListenWebSocket(CancellationToken cancellationToken) { using ClientWebSocket webSocketClient = new(); await webSocketClient.ConnectAsync(CoreConfigManager.WebSocketUri, CancellationToken.None).ConfigureAwait(false); - Memory buffer = new byte[1024]; + + // 256-4096 + Memory buffer = new byte[1024 * 4]; while (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested && webSocketClient.State is WebSocketState.Open) { @@ -85,13 +87,6 @@ private static void ListenWebSocket(CancellationToken cancellationToken) StatsUtils.StopStatsTimer(); } } - else - { - if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested) - { - await Task.Delay(200).ConfigureAwait(false); - } - } if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested) { @@ -123,10 +118,6 @@ private static void ListenWebSocket(CancellationToken cancellationToken) else { Utils.Logger.Verbose(webSocketException, "Couldn't connect to the WebSocket server, probably because it is not running"); - if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested) - { - await Task.Delay(200).ConfigureAwait(false); - } } } }