awslabs / aws-mobile-appsync-sdk-js

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

Restarting Subscription once device moves online-offline-online (network connection) #602

Open annucy opened 3 years ago

annucy commented 3 years ago

Do you want to request a feature or report a bug? Bug

What is the current behavior? I am using awss-mobile-appsync-sdk-js and use Subscriptions (with buildSubscription helper) on componenetDidMount() method. -> Once device is online, subcription works fine. Now if network connectivety goes off, subscription will stop(as expected). -> Again, once connectivety comes back, I would expect subscription to restart automatically. But it does not happen

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. I am using awss-mobile-appsync-sdk-js and use Subscriptions (with buildSubscription helper) on componenetDidMount() method. This is the code I am using

const SubscribeToMoreOptions = this.props.chatResponse.subscribeToMore(buildSubscription( { query: postSubscription, variables: { conversationId: 'g-' + this.props.navigation.state.params.group.id } }, { query: allMessageConnection, variables: { conversationId: 'g-' + this.props.navigation.state.params.group.id } }, 'id', 'add')) }

-> Once device is online, subcription works fine. Now if network connectivety goes off, subscription will stop(as expected). -> Again, once connectivity comes back, I would expect subscription to restart automatically.

Could you explain how these scenario needs to be handled?

What is the expected behavior? Subscription should restart based on connectivety, or there should be call back for the user to handle this(restart subscription).

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions? "aws-appsync": "^4.0.1", "aws-appsync-react": "^4.0.1", "react-apollo": "^2.5.8", "react": "16.9.0", "react-native": "0.61.5",

szad769 commented 3 years ago

Same Issue.

jwelmac commented 3 years ago

Same here