Search code examples
firebasefirebase-realtime-databasegoogle-cloud-functionsgeofire

Geofire queries that last long in Firebase cloud functions


I'm writing an alert system that push notifies people when they enter a certain area. I'm using GeoFire to run the geoquery from a Firebase cloud function. The thing is that I need the geoquery to remain open for as long as the alert is active, so I'm cancelling it with a setTimeout, with a duration that can last for some hours. I know functions should be kept short, less than a minute or so. Any idea on how to keep the geoquery alive in a cloud function?


Solution

  • There is currently no way to keep a GeoFire listener active in a Cloud Function for Firebase.

    What you could do is a trigger a function from a regular Realtime Database update and then check of the updated data falls into your range.