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

[Feedback] Amplify subscriptions stop when app goes to sleep. Don't resubscribe #8513

Closed
spmatthews03 opened this issue Jun 28, 2021 · 11 comments
Assignees
Labels
API Related to REST API issues feature-request Request a new feature transferred This issue was transferred from another Amplify project

Comments

@spmatthews03
Copy link

Page: /guides/q/platform/js

Feedback:

I'm trying to have a simple subscription and it works until the phone goes to sleep, or if the app is in the background for too long. I would like a way to resubscribe to the data so my UI and my server are not out of sync.

@medelman17
Copy link
Contributor

Hi @spmatthews03! This looks like a JS library-related issue. I'm going to transfer this issue there.

@medelman17 medelman17 transferred this issue from aws-amplify/docs Jun 29, 2021
@siegerts siegerts added the transferred This issue was transferred from another Amplify project label Jun 30, 2021
@chrisbonifacio chrisbonifacio added the API Related to REST API issues label Jul 1, 2021
@chrisbonifacio
Copy link
Contributor

@spmatthews03 are you using API or DataStore in your app?

@chrisbonifacio chrisbonifacio added the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label Jul 1, 2021
@chrisbonifacio chrisbonifacio added this to To Do in MLH Summer 2021 Jul 1, 2021
@spmatthews03
Copy link
Author

@chrisbonifacio API. I semi fixed it buy a listener on AppState and if subscriptions are null then I reload ALL subscriptions. just 8 of them soits not terrible and only if their componentn is mounted

@stale stale bot removed the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label Jul 1, 2021
@dave-vazquez
Copy link

@spmatthews03 I'm currently running into the same issue. Can you share your implementation for listening to AppState, checking if subscriptions are null and reloading all subscriptions?

@chrisbonifacio
Copy link
Contributor

@spmatthews03 Nice workaround! I'm going to find out if this issue is expected behavior so I know if it's either a bug or a feature request that can be built in.

@chrisbonifacio chrisbonifacio self-assigned this Jul 2, 2021
@chrisbonifacio chrisbonifacio added this to Needs Triage in Issues Triaging via automation Jul 2, 2021
@dave-vazquez
Copy link

@spmatthews03 Nice workaround! I'm going to find out if this issue is expected behavior so I know if it's either a bug or a feature request that can be built in.

@spmatthews03 Thank you, this would be super-helpful if you could find out.

@chrisbonifacio
Copy link
Contributor

chrisbonifacio commented Jul 2, 2021

Hey @spmatthews03 and @dave-vazquez, so I did talk to the team about this. At the moment re-establishing connections to subscriptions is only handled by Amplify in the DataStore category. Unfortunately, this functionality is not yet available out of the box from the API category as explained here #7057 (comment)

That being said, until we do implement automatic resubscribing in API I'm going to label this as a feature request. I'm personally interested in this and I know there are examples of how to handle this out there in the wild so I'll try to find that and post it here as well as make sure the docs are updated with a code snippet that achieves that.

@chrisbonifacio chrisbonifacio added the feature-request Request a new feature label Jul 2, 2021
@dave-vazquez
Copy link

Thanks @chrisbonifacio ! Very much apprrciated

@chrisbonifacio chrisbonifacio removed this from To Do in MLH Summer 2021 Jul 6, 2021
@CSHaze
Copy link

CSHaze commented Mar 25, 2022

Is this still being worked on?

@rudalson
Copy link

Hello. I need to solve this issue. It happens to frequently in ios. @spmatthews03 Can you also share your workaround to me?

@stocaaro
Copy link
Contributor

Good news. Automated Reconnection is now available on the latest aws-amplify release! Review the updated subscription docs and consider any application behavior you may want to add to best meet your users needs when subscriptions reconnect.

Please review our breaking change guidance before upgrading your application.

To upgrade Amplify to version 5, run the following in your project folder:

yarn add aws-amplify@latest

Check package.json to see if your project uses other @aws-amplify/* packages directly and upgrade them to latest as well.

With this behavior released, I am closing this issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to REST API issues feature-request Request a new feature transferred This issue was transferred from another Amplify project
Projects
No open projects
Issues Triaging
Pending Triage
Development

No branches or pull requests

8 participants