Firebase multiple child listeners

前端 未结 1 728
感情败类
感情败类 2020-12-11 05:20

We\'re developing a mobile app (Android and iOS for now) for which we\'re using Firebase for chat and other real-time messages.

The structure we\'re using is:

<
相关标签:
1条回答
  • 2020-12-11 05:32

    [Engineer at Firebase] In general, Firebase listeners are very inexpensive in their own right. Where you might start to see bottlenecks are with the amount of data transferred over the wire.

    In the case you described above, it sounds like you're attaching a listener to /a, a/b, and a/b/c, which will not cause duplicate data going over the wire, because all nested data is already captured by the listener on /a. The Firebase client is smart about not duplicating this data.

    As for the battery, there are a lot of factors to contribute, but try profiling different combinations of behaviors between quickly-changing data, slowly-changing data, more writes, fewer writes, more / less UI or CPU, etc. It's likely some combination of factors, but additional debugging will help you narrow down the culprit.

    0 讨论(0)
提交回复
热议问题