作者:l佳恒_756 | 来源:互联网 | 2023-05-16 16:39
FirebaseDatabaseofferstwomethodstotakeaclientoffline:FirebaseDatabase提供了两种使客户端脱机的方法:Datab
FirebaseDatabase offers two methods to take a client offline:
FirebaseDatabase提供了两种使客户端脱机的方法:
DatabaseReference.goOffline()
DatabaseReference.goOffline()
Manually disconnect the Firebase Database client from the server and disable automatic reconnection. Note: Invoking this method will impact all Firebase Database connections.
手动断开Firebase数据库客户端与服务器的连接并禁用自动重新连接。注意:调用此方法将影响所有Firebase数据库连接。
FirebaseDatabase.goOffline()
FirebaseDatabase.goOffline()
Shuts down our connection to the Firebase Database backend until goOnline() is called.
关闭我们与Firebase数据库后端的连接,直到调用goOnline()。
A call to FirebaseDatabase.getInstance().goOffline()
produces the expected results:
调用FirebaseDatabase.getInstance()。goOffline()会产生预期的结果:
ValueEventListener
for ".info/connected" fires for the disconnect
- “.info / connected”的ValueEventListener将触发断开连接
OnDisconnect
action executes
- 执行OnDisconnect操作
ValueEventListener
s for remote changes do not fire, those for local changes do
- 用于远程更改的ValueEventListeners不会触发,用于本地更改的值
CompletionListener
s do not fire
- CompletionListeners不会触发
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()
?
对DatabaseReference.goOffline()的调用似乎没有任何效果。上面列出的行为都不会发生。它坏了吗?如果没有,它与其他goOffline()有何不同?
1 个解决方案