Firebase Event Guarantee: Event Order

前端 未结 1 364
自闭症患者
自闭症患者 2021-01-20 12:19

I am just getting started with Firebase and had a question regarding the Firebase Event Guarantees listed at the following URL: Event Guarantees.

One of the guarante

相关标签:
1条回答
  • 2021-01-20 12:35

    The only guarantee is that the values will be eventually consistent. Thinking this through, it's the only reasonable answer. Any operation over the internet could be delayed indefinitely by any moving part in the process, thus producing out-of-order events received by the client, regardless of the order they reach the server.

    Thus, you are guaranteed that all the clients will see both of the added child nodes eventually, and that they will be consistent across all the clients (eventually).

    If you want to guarantee the order of events, you are using a messaging queue--which is one adaptation of how you can use Firebase, but not the only one. This is easily achieved using the push() method, which creates chronologically ordered, unique ids.

    You can also throw in a timestamp and utilize the orderByChild method to sort records.

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