Open piavgh opened 5 years ago
@piavgh it's not ~real time~ but it might help: on the Google app scripts console go to edit > current project's triggers - there you can configure the function to run every X (even as often as once a minute). Hope it helps :)
Hey @piavgh, glad you're interested in the library!
This library doesn't currently have realtime update support. It looks like the Firestore REST API does support realtime updates, as seen here under the firestore.projects.databases.documents.listen
group.
If you want to take a look through that reference and make a PR adding realtime support, that would be awesome! In the meantime, perhaps @willianwelbert's idea would work for your use case.
A quick review seems to make this plausible, a solid starting point would be to check out the Firebase Rest API Realtime Updates page.
There's a lot of good info there, if someone can take the time to make a PR for this!
The APPS Script has a limited time of being active, so the library itself cannot listen to updates (the script would time-out).
You could trigger the script by webhook, but that means you would have to write a listener somewhere else.
Hi @grahamearley ,
Thank you for making this library. I'm working on a GAS project and I'm glad that there is Firestore now (I was puzzled when I had to choose between MongoDB and Firebase Realtime Database - MongoDB is not realtime, no GAS support, while Firebase Realtime Database is totally sucked)
I checked your document but I can't find how to listen for realtime updates https://firebase.google.com/docs/firestore/query-data/listen
How can I do it with this library? Or if this library can't handle it yet, is there any way to do it manually with GAS?
Thank you.