0

I'm using React Native, and after background the application or lock the phone, when you focus it again all the subscriptions are disconnected and they are not receving events anymore (both useSubscription and subscribeToMore)

I'm creating the client in this way

const url = config.aws_appsync_graphqlEndpoint;
const subs = createSubscriptionHandshakeLink(config, url);

const client = new ApolloClient({
  link: ApolloLink.from([createAuthLink(config), subs]),
  cache: new InMemoryCache(),
});

This are the versions that I'm using

"aws-appsync-auth-link": "^3.0.7",
"aws-appsync-subscription-link": "^3.1.2",
"@apollo/client": "^3.7.4",
"react-native": "0.70.3",

thanks!

Juan Salvador Portugal
  • 1,233
  • 4
  • 20
  • 38
  • Have you discovered any solutions for the issue? Just to clarify, I'm using React.js, but I believe the implementation process remains unchanged. Thanks in advance. – Arian Hamdi Apr 16 '23 at 08:00
  • @ArianHamdi I end up implementing a ugly workaruond, just remove al "subscribeToMore" subscriptions when you background the app or lose internet, and subscribe them again when the app is en foreground or you get internet connection again, it looks to solve the issue in most of the cases – Juan Salvador Portugal May 11 '23 at 17:42
  • It would be great if you could share a code solution! – George Barlow May 22 '23 at 05:30

0 Answers0