Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: WebSocket closes after short time of inactivity #9

Closed
CrsiX opened this issue Apr 15, 2023 · 2 comments
Closed

Android: WebSocket closes after short time of inactivity #9

CrsiX opened this issue Apr 15, 2023 · 2 comments
Labels
android Only on Android devices enhancement New feature or request

Comments

@CrsiX
Copy link
Member

CrsiX commented Apr 15, 2023

When the screen went off for something like a minute, the WebSocket connection gets closed. Examine ways to keep the connection open as long as possible without forcing the whole app to stay in the foreground.

This is related to #3.

@CrsiX
Copy link
Member Author

CrsiX commented May 15, 2023

In the current test, the WebSocket died after relatively exactly 15 minutes (screen was kept on, app was in the background). The retry-coroutines jumped on board and retried re-connecting the WebSocket, but it failed with ConnectTimeout after exactly 5 seconds, despite WiFi being available. Could the network be throttled?

The attempts to re-connect the WebSocket were going on for around 90 seconds before they stopped, alongside a coroutine which just printed numbers to verify it: the app was suspended by the system.
On re-opening the app, both the onCreate and onResume events got fired, so the app was completely closed, I suspect?

@CrsiX CrsiX added the android Only on Android devices label May 20, 2023
@CrsiX
Copy link
Member Author

CrsiX commented May 20, 2023

Running a "Service" would solve that problem. However, this is currently out of scope, since the base game doesn't provide that functionality either. The current solution is good enough, since it works as long as the game is in the background (paused but not destroyed). The current V2 turn checker also provides relatively good support for re-connects and receiving updates in time.

@CrsiX CrsiX closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Only on Android devices enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant