Is there any way to avoid polling the server in React Native every so often to check for updates on data?? I am using python in AWS Lightsail on the back end, and ideally would like the front end to be notified when certain data updates on the back end, and re-render only upon this occurrence. I am currently ignorant of how this might be done, but it seems like this would be a very common thing and I am just looking in the wrong places of how to do this. Any suggestions?
Asked
Active
Viewed 776 times
1 Answers
2
Websockets: If you only want the app to update when its running, your client/ app could open a websocket to your backend, and have the backend send updates whenever it needs to. Your application needs to decide when to send these messages to clients, but will already have a connection established (the websocket). I found this SO answer interesting.
Push notifications: Alternatively, you could have something that triggers when you want clients to be updated (a serverless function which triggers on data change in your database?). The function would send a notification via FCM (firebase cloud messaging for Android devices) or APNs (Apple push notification service for iOS), and your client could have a handler for this notification.

Ben Butterworth
- 22,056
- 10
- 114
- 167