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

Pusher not consistently reconnecting when app comes back into foreground #420

Open
sarya opened this issue Nov 29, 2023 · 6 comments
Open

Comments

@sarya
Copy link

sarya commented Nov 29, 2023

Steps to reproduce

Open the app, put the app in the background (e.g. switch to another app or lock the sreen), return to the app. Sometimes Pusher will reconnect in this scenario, but eventually the app will come into the foreground and Pusher will not reconnect. The user will have to force quit/relaunch the app to restore the connection.

Expected behavior

Pusher reconnects/resubscribes to channels every time the app is moved from background to foreground.

Actual behavior

The app is brought back into the foreground but Pusher stays in the "disconnected" state (according to the debug console).

I have attempted to play around with the maxReconnectGapInSeconds and reconnectAttemptsMax settings on the PusherConnection object but am still seeing the same outcome.

...

@sarya
Copy link
Author

sarya commented Nov 29, 2023

Looks similar to this Java client issue from a few years back: pusher/pusher-websocket-java#197

@dgarciasquare1
Copy link

Any solution to this problem ??

@benw-pusher
Copy link

We have made some changes that may help in this area, I will look into getting a new release made so you can upgrade.

@benw-pusher
Copy link

We just released version 10.1.5 - could you upgrade and let me know if this helps resolve the issue?
https://github.com/pusher/pusher-websocket-swift/releases/tag/10.1.5

@spasbilyarski
Copy link

spasbilyarski commented Mar 7, 2024

@benw-pusher I updated to 10.1.5 but started seeing a handshake problem:

[PUSHER DEBUG] websocketDidReceiveMessage {"event":"pusher:error","data":{"code":4201,"message":"Pong reply not received"}}
<PusherSwift.PusherError: 0x600000c1fc60>
nw_read_request_report [C5] Receive failed with error "Socket is not connected"
[PUSHER DEBUG] Websocket received error. Error: POSIXErrorCode(rawValue: 57): Socket is not connected
[PUSHER DEBUG] Websocket received error. Error: POSIXErrorCode(rawValue: 57): Socket is not connected
[PUSHER DEBUG] Websocket is disconnected but no error received Close code: Optional(1001). Reason: The websocket disconnected unexpectedly.
[PUSHER DEBUG] Websocket is disconnected but no error received Close code: Optional(1001). Reason: The websocket disconnected unexpectedly.

Just rolled back to 10.1.4 and will get back to you if I see this problem persisting in the older version, making this comment unrelated.

EDIT: The problem is 10.1.5 specific.
EDIT2: This issue is happening after ~2 hours of receiving messages in foreground.

@DelphineGarcia
Copy link

DelphineGarcia commented Jul 30, 2024

We are also facing some reconnection issues after a long time in background. Any news on this? Using 10.1.4 can't be a solution for us since there are even more reconnection issue. Thanks

Capture d’écran 2024-07-31 à 15 47 23

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

No branches or pull requests

5 participants