awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
916 stars 265 forks source link

Managing Reconnection Attempts for AWS AppSync Subscription with Apollo #758

Open objectiveSee opened 8 months ago

objectiveSee commented 8 months ago

I'm working on a project using AWS AppSync with Apollo to manage GraphQL subscriptions. I'm using aws-appsync-subscription-link with an Apollo subscription for real-time data. Everything works fine until the subscription connection is lost. Then, I have trouble getting the connection back automatically.

My main question is how to set up aws-appsync-subscription-link or Apollo so that if a subscription connection is lost or has an error, it tries to reconnect automatically. I've looked through a lot of documentation and forums but haven't found a clear answer or example on how to handle automatic reconnection in these situations.

I'd appreciate any advice or examples on how to adjust the configuration to retry the connection if it fails. Tips on the best ways to handle reconnection with AWS AppSync and Apollo would be really helpful. Thanks!

For more background, you can check out an issue I opened in the Apollo repository. They sent me here to find a solution to my problem.

Issue Link

Are you requesting a feature or reporting a bug? 🐛 bug

What's happening now? When a subscription connection is lost, the system doesn't try to reconnect automatically.

If this is a bug, can you tell me how to reproduce it and, if possible, show a simple example of the problem?

What should happen?

Which versions and environments (browser, react-native, nodejs) / OS are affected? Did it work in earlier versions?

Environment: React OS: Mac

Related Issues

mengdi commented 1 month ago

+1 on this issue

samsuchin commented 1 month ago

+1