如何在读取事件时触发Firebase云功能 [英] how to trigger firebase cloud function on read event
问题描述
可以在写入事件中触发云功能 ,但是我在阅读后找不到用于触发的任何文档(例如,firebase.database().ref().once('value')...
).
It is possible to trigger cloud functions on write events, but I can't find any documentation for triggering after reading (eg, firebase.database().ref().once('value')...
).
关于处理此用例的最佳方法的任何建议吗?
Any recommendations on the best way to go about handling this use case?
推荐答案
没有用于响应客户端读取的触发器.假定应用程序将进行大量读取,并且为每个读取运行代码将非常昂贵.如果要在客户端执行某些操作时运行一些代码,请在应执行该操作时让客户端调用HTTPS函数.
There is no trigger for responding to client reads. It's assumed that apps will have massive amounts of reads, and having code run for each of those reads would be incredibly expensive. If you want to run some code when the client performs some action, have the client call an HTTPS function when that action should occur.
这篇关于如何在读取事件时触发Firebase云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!