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

fix(iOS): Socket-related improvements #354

Merged
merged 6 commits into from
Aug 19, 2024
Merged

fix(iOS): Socket-related improvements #354

merged 6 commits into from
Aug 19, 2024

Conversation

KaylaBrady
Copy link
Collaborator

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.

  1. Upgrading SwiftPhoenixClient, since the latest version fixes thread-related crashes
  2. Leaving & rejoining alerts & vehicles channels after backgrounding
  3. Remove unnecessary duplicate calls to 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)
  4. Adding some sentry breadcrumbs for socket events to aid in future debugging if we continue to see these issues

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.

Error when receiving Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLStringKey=wss://mobile-app-backend-staging.mbtace.com/socket/websocket?vsn=2.0.0, NSErrorFailingURLKey=wss://mobile-app-backend-staging.mbtace.com/socket/websocket?vsn=2.0.0}

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.

@KaylaBrady KaylaBrady requested a review from a team as a code owner August 16, 2024 21:07
@@ -29,7 +29,7 @@ struct HomeMapView: View {
@State var globalMapData: GlobalMapData?
@State var stopMapData: StopMapResponse?

var vehiclesRepository: IVehiclesRepository
@State var vehiclesRepository: IVehiclesRepository
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue as here - calls to leave the channel were for a different repository than what was originally joined

Copy link
Member

@boringcactus boringcactus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this helps.

@KaylaBrady KaylaBrady merged commit e5e96e9 into main Aug 19, 2024
5 checks passed
@KaylaBrady KaylaBrady deleted the kb-socket-crashes branch August 19, 2024 13:17
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.

2 participants