endel / NativeWebSocket

🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Other
1.13k stars 155 forks source link

Unity Application freezing when network connection is lost. Is there any timeout parameter that can be configured ? #48

Open saikiran469 opened 2 years ago

saikiran469 commented 2 years ago

Hi @endel, when I was testing, I came across this issue.

Context: Messages would be published from my application continuously with a frequency of 20 messages per second. When the application is running and the network connection is stable, and all the messages sent through this function - SendText are being successfully delivered.

Issue: With the above-mentioned context, in such a case when the internet gets disconnected, the Unity Application is getting frozen. When checked with the profiler, below is the information gathered. WebSocketSendMessageFunctionProfiler

The application is coming back to a normal state after ~16 seconds. And when the application comes back to a normal state, the below error is being logged in the console. And only then OnClose callback of WebSocket is getting invoked. WebSocketExceptionInfo.txt

I assume this might happen due to the setting "-1" as a timeout parameter for a task. If that is the case, can you please let me know on how to configure the timeout parameter?

HaSyHieu commented 3 months ago

is there any update on this issue ?