From d56bfff9f8b86a702e54fedf9148b86dd509dbd0 Mon Sep 17 00:00:00 2001 From: Harlan Crystal Date: Sat, 27 Jun 2026 22:23:09 -0700 Subject: [PATCH] Log WebSocket connection-attempt timeout as a warning, not an exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WebsocketClient.ConnectAsync guards the native ClientWebSocket.ConnectAsync with a timeout (it can hang on some Unity/Android versions). On timeout it throws TimeoutException, which HandleConnectionFailedAsync routes to the catch-all else branch and logs via _logs.Exception(...) (Debug.LogException) — i.e. at error severity. A connection-attempt timeout is an expected, transient failure that the reconnect flow recovers from, so reporting it as an exception floods crash/error reporting tools (Sentry, Bugsnag, etc.) with handled, non-actionable noise. Treat TimeoutException like the other expected connection-failure types and log it as a warning instead. --- .../Plugins/StreamChat/Libs/Websockets/WebsocketClient.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Plugins/StreamChat/Libs/Websockets/WebsocketClient.cs b/Assets/Plugins/StreamChat/Libs/Websockets/WebsocketClient.cs index d268894a..0b30ab8d 100644 --- a/Assets/Plugins/StreamChat/Libs/Websockets/WebsocketClient.cs +++ b/Assets/Plugins/StreamChat/Libs/Websockets/WebsocketClient.cs @@ -403,6 +403,14 @@ await TryCloseAndDisposeAsync(WebSocketCloseStatus.ProtocolError, { LogExceptionIfDebugMode(exception); } + else if (exception is TimeoutException) + { + // A connection-attempt timeout (see the timeout guard in ConnectAsync) + // is an expected, transient failure that the reconnect flow recovers + // from. Log it as a warning rather than surfacing it as an exception, + // so it does not flood crash reporting with handled, non-actionable noise. + _logs.Warning(exception.ToString()); + } else { _logs.Exception(exception);