Firebase Realtime Database onValue()更新

时间:2019-02-01 06:20:31

标签: firebase firebase-realtime-database

我想肯定地知道FIR实时数据库如何处理value对侦听器的更新。

具体来说,我想知道这些value更新是通过电线还是整个文档 delta 的形式发送的,同时还发送了孩子。

我已经对该主题进行了一些研究,发现以下来源(根据我的理解)建议了不同的方法

  1. https://firebase.google.com/docs/database/admin/retrieve-data The value event is used to read a static snapshot of the contents at a given database path, as they existed at the time of the read event. It is triggered once with the initial data and again every time the data changes. The event callback is passed a snapshot **containing all data at that location**, including child data. In the code example above, value returned all of the blog posts in your app. Everytime a new blog post is added, the callback function will return all of the posts.

  2. General questions about data transfer in Realtime Database Suggests that data sent over the wire is deltas

这使我假设数据实际上是作为增量通过有线发送的,但是客户端SDK会将增量与本地副本进行了相关合并,并在onValue()回调中显示了更改的整个列表。尽管这只是一个假设,但我想请问有人可以澄清一下。

预先感谢

0 个答案:

没有答案