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

Reconnect when returning from background #1122

Merged
merged 5 commits into from
Aug 31, 2023
Merged

Conversation

carson-katri
Copy link
Contributor

In some cases, when left in the background for a few minutes, the app will lose connection. This PR adds a check that reconnects the socket when returning from the background.

It also fixes an issue with channel rejoins where diffs would be improperly applied, leading to a crash.

@carson-katri carson-katri requested a review from a team August 31, 2023 20:15
@carson-katri carson-katri merged commit 689d680 into main Aug 31, 2023
2 checks passed
@carson-katri carson-katri deleted the background-app-disconnect branch August 31, 2023 20:24
@bcardarella
Copy link
Collaborator

bcardarella commented Aug 31, 2023

Am I correct in assuming that the socket reconnect will result in an app state reset? If so then we should explore solutions like this https://fly.io/phoenix-files/restore-liveview-state-on-startup/

@carson-katri
Copy link
Contributor Author

Yes, that’s correct — assigns will be lost. It might be possible to keep sending the heartbeat message in a background task, but I’d have to experiment with that a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS: App crashes during login flow
3 participants