With the way Apollo GraphQL subscriptions puts data in the store, the app begins to lag and freeze after only few updates from subscriptions. On my app this happens after the user receives a few new messages in succession. https://github.com/apollographql/react-apollo/issues/1535 is related and the solution seems to be to use a separate store.
Phones disconnect websocket connections when lock/idle to conserve power, therefore my subscriptions only work for a few minutes that the user has the app open. If they were to lock their phone, they would have to close the app entirely and then reopen to have a websocket connection until they decide to lock their phone again. I am currently using <Query> and subscribeToMore, and have those ws.subscriptionClient.on(...) listeners up, but I have not seen a clear example of how to manually: "reconnect the websockets => refresh all of the queries affected to get the data that was dropped => resubscribe to everything again".
These are two big problems that browsers don't really have a problem with as they aren't as memory-constrained as a phone and don't disconnect websockets to save power. I have been researching all over this repo and react-apollo and trying what some users have posted, but if anyone has any other creative solutions that worked for them for these specific React Native problems, please share. I hope I am just doing something stupid/wrong here and don't need to switch to Firebase or something because my entire app is already built and mostly functioning with Apollo GraphQL + Subscriptions.
With the way Apollo GraphQL subscriptions puts data in the store, the app begins to lag and freeze after only few updates from subscriptions. On my app this happens after the user receives a few new messages in succession. https://github.com/apollographql/react-apollo/issues/1535 is related and the solution seems to be to use a separate store.
Phones disconnect websocket connections when lock/idle to conserve power, therefore my subscriptions only work for a few minutes that the user has the app open. If they were to lock their phone, they would have to close the app entirely and then reopen to have a websocket connection until they decide to lock their phone again. I am currently using
<Query>
andsubscribeToMore
, and have thosews.subscriptionClient.on(...)
listeners up, but I have not seen a clear example of how to manually: "reconnect the websockets => refresh all of the queries affected to get the data that was dropped => resubscribe to everything again".These are two big problems that browsers don't really have a problem with as they aren't as memory-constrained as a phone and don't disconnect websockets to save power. I have been researching all over this repo and react-apollo and trying what some users have posted, but if anyone has any other creative solutions that worked for them for these specific React Native problems, please share. I hope I am just doing something stupid/wrong here and don't need to switch to Firebase or something because my entire app is already built and mostly functioning with Apollo GraphQL + Subscriptions.