fix(iOS): Socket-related improvements #354
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Ticket: Investigate Sentry Phoenix Errors
What is this PR for?
I was unable to reproduce this bug locally, but made a few improvements to the socket/channel code that should address possible causes of bugginess in our realtime data.
attach
socket before joining each channel. (I have a theory these repeated joins are messing with the heartbeat timer, but haven't been able to duplicate the issue locally)Testing
What testing have you done?
Added tests for the new backgrounding behavior.
Ran locally while repeatedly backgrounding / foregrounding and confirmed that alerts & vehicles are now left as expected.
I also noticed the below log when backgrounding the app. It doesn't seem to be affecting things negatively, but I added an issue for it.
Occasionally I see the socket mysteriously re-open after backgrounding with this error repeated a few times. There may be future work to address that, but in the meantime, hoping to get these changes out to see if they improve anything.