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

Keeping subscriptions alive in the background #3509

Closed
tunds opened this issue Jan 29, 2025 · 3 comments
Closed

Keeping subscriptions alive in the background #3509

tunds opened this issue Jan 29, 2025 · 3 comments
Labels
question Issues that have a question which should be addressed

Comments

@tunds
Copy link

tunds commented Jan 29, 2025

Question

I'm currently using the subscriptions functionality and was looking for any information in the documentation that discusses how subscriptions are kept alive if your app is either in the background for x amount or time or even if the device is locked. Is anyone able to support or offer any insights into the following?

  1. If I leave the app in the background for an extended period of time i.e. users device is locked and the app is in the background for 30 - 40 minutes. Does the library automatically handle this?
  2. If we do need to add in additional logic, is there a reference anywhere that goes into detail about this?
@tunds tunds added the question Issues that have a question which should be addressed label Jan 29, 2025
@BobaFetters
Copy link
Member

There is a property on the WebSocketTransport called reconnect that controls whether the web socket should automatically attempt to reconnect when it loses connection, so that should reconnect the web socket when returning from the background. If you wanted more control over it you could manual handle disconnecting/reconnecting on application background/foreground. There isn't anything explicitly keeping the connection alive while the app is in the background though.

If you were looking to keep the subscription alive the whole time and actually receive data you would need to handle configuring the background task for your app and the web socket itself.

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

@tunds
Copy link
Author

tunds commented Jan 30, 2025

Awesome thanks for the pointers, will take a look into this 👌🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that have a question which should be addressed
Projects
None yet
Development

No branches or pull requests

2 participants