In FireStore how to know if client is listening to particular document

I have the following scenario.

  1. Sensor generates data every 30 seconds.
  2. Update sensor data on FireStore document.
  3. Mobile app shows the sensor data in realtime.

One problem with above steps is that lot of data writes takes place, which increases billing. I want to optimize it by changing step 2.

  1. Update sensor data on FireStore document only if mobile app is listening to realtime updates

To do this optimisation I need a way to know if app is listening to realtime update. So is there a FireStore event/callback fired when app starts/stops to listen to realtime update.

Read more here:

Content Attribution

This content was originally published by PAVAN KUMAR at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: