NativeWebSocket icon indicating copy to clipboard operation
NativeWebSocket copied to clipboard

App Freezing when internet is turned off but still device is connected to wi-fi network

Open tejasriram13 opened this issue 2 years ago • 1 comments

Our app use-case contains where we are dispatching messages on Web socket every X seconds.

If we disconnect the app from internet (Using a mobile hotspot and turning off the internet source without turning off the mobile hotspot), then app is freezing after sometime.

Our observation from logs:

  • When internet connection is turned off, Websocket state is still being returned as Open, instead of Closed
  • So, the messages are still trying to be dispatched on Websocket and after sometime, the task at this line is causing app freeze - https://github.com/endel/NativeWebSocket/blob/60b2960bef354ba9886af15a9a83a6e61164240b/NativeWebSocket/Assets/WebSocket/WebSocket.cs#L569

Please let me know how to overcome this issue.

tejasriram13 avatar Sep 20 '23 09:09 tejasriram13

I have published a pull request that fixes this exact issue. You can try that FixedApplicationFreezeIssueOnInternetDisconnect #90

talhaArthur avatar Oct 24 '23 19:10 talhaArthur