Hacker News new | ask | show | jobs
by akanet 3392 days ago
I can't tell from the docs - are server functions able to to modify or reject writes to refs in the realtime DB before they happen?
1 comments

No. All events are asynchronous. This use case is best simulated by having clients post to a queue. Cloud functions then either discards or applies writes in that queue.
You should add this technique to the docs! It makes you realize that the Cloud Functions feature is a lot more powerful than you might initially think.
A lot of people use the Firebase Queue library for this:

https://github.com/firebase/firebase-queue