WebSocket Does Not Reconnect When App Resumes from Background (Guest User) #3338
Labels
🐞 Bug
An issue or PR related to a bug
🌐 SDK: StreamChat (LLC)
Tasks related to the StreamChat LLC SDK
🔜 Upcoming
This issue is fixed in “develop” and will be available in the next release
What did you do?
I launched the app, waited for a few minutes, and then resumed it.
What did you expect to happen?
I expected the WebSocket to reconnect when the app resumes from the background.
What happened instead?
The WebSocket does not reconnect when the app resumes from the background.
GetStream Environment
GetStream Chat version: 4.60.0
GetStream Chat frameworks: StreamChat, StreamChatUI
iOS version: iOS17.4
Swift version: 5.9
Xcode version: 15.3
Device: Simulator iPhone 15 Pro
Additional context
Reproduce Step
Guest User
Start a chat
Screencast
https://drive.google.com/file/d/1-parw6tuS02VBZW7cG3__1Pb4e3ciogL/view?usp=sharing
(Here is a link to GoogleDrive due to its large size)
Additional Information
I discovered that the connectGuestUser function calls logOut first. As a result, ConnectionRecoveryHandler.stop is invoked, causing the monitoring of appDidBecomeActive and appDidEnterBackground to stop. This leads to the issue where "the WebSocket does not reconnect when the app resumes from the background.
https://github.com/GetStream/stream-chat-swift/pull/3303/files#diff-5aa17a3514ab85c33231ca8983e4c32096742c79d97924fe31e71ebb0ac7d540R385
This issue reliably reproduces with a guest user, but it is likely to occur under any condition where logOutFirst is true.
The text was updated successfully, but these errors were encountered: