问题描述
FirebaseDatabase提供了两种让客户端脱机的方法: $ b
$ b
到 FirebaseDatabase.getInstance()。goOffline()
产生预期的结果:
$ b
-
ValueEventListener
为.info / connected触发断开连接 -
OnDisconnect
action执行
ValueEventListener
s用于远程更改不会触发,本地更改会执行
CompletionListener
s不会触发
调用 DatabaseReference.goOffline()
似乎不起作用。没有上面列出的行为发生。它坏了吗?如果不是这样,它与另一个 goOffline()
?
有什么不同?这是9.x版本中的一个疏忽。 FirebaseDatabase.getInstance()。goOffline()
/ goOnline()
是正确的使用方法, DatabaseReference.goOffline()
/ goOnline()
确实会被破坏,并将在未来版本中删除。对不起,我感到困惑!
FirebaseDatabase offers two methods to take a client offline:
A call to FirebaseDatabase.getInstance().goOffline()
produces the expected results:
ValueEventListener
for ".info/connected" fires for the disconnectOnDisconnect
action executesValueEventListener
s for remote changes do not fire, those for local changes doCompletionListener
s do not fire
A call to DatabaseReference.goOffline()
seems to have no effect. None of the behavior listed above occurs. Is it broken? If not, how does it differ from the other goOffline()
?
This was an oversight in the 9.x release. FirebaseDatabase.getInstance().goOffline()
/ goOnline()
are the correct methods to use and DatabaseReference.goOffline()
/ goOnline()
are indeed broken and will be removed in a future release. Sorry for the confusion!
这篇关于为什么FirebaseDatabase客户端的两种方法脱机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!