From 74a0847888664dc22bdc21331663ae0b3d7841b2 Mon Sep 17 00:00:00 2001 From: talhaArthur Date: Wed, 25 Oct 2023 00:36:31 +0500 Subject: [PATCH] FixedApplicationFreezeIssueOnInternetDisconnect --- NativeWebSocket/Assets/WebSocket/WebSocket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NativeWebSocket/Assets/WebSocket/WebSocket.cs b/NativeWebSocket/Assets/WebSocket/WebSocket.cs index 503cf43..f842eb1 100644 --- a/NativeWebSocket/Assets/WebSocket/WebSocket.cs +++ b/NativeWebSocket/Assets/WebSocket/WebSocket.cs @@ -566,7 +566,7 @@ private async Task SendMessage(List> queue, WebSocketMessageT { // Send the message synchronously. var t = m_Socket.SendAsync(buffer, messageType, true, m_CancellationToken); - t.Wait(m_CancellationToken); + await Task.WhenAny(t, Task.Delay(TimeSpan.FromMilliseconds(-1), m_CancellationToken)); } finally {