像实时数据库中一样,firestore中是否有类似onDisconnect()的方法? [英] Is there any method like onDisconnect() in firestore like there is in realtime database?

查看:58
本文介绍了像实时数据库中一样,firestore中是否有类似onDisconnect()的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在onDisconnect()的帮助下在实时数据库中检查用户的在线状态,但是现在我转到了firestore,在其中找不到任何类似的方法.

I want to check user's online status, in realtime database I used to check this with the help of onDisconnect(), but now I've shifted to firestore and can't find any similar method in that.

推荐答案

根据此

onDisconnect类最常用于管理应用程序中的状态,在该应用程序中检测连接了多少个客户端以及其他客户端何时断开连接很有用.

The onDisconnect class is most commonly used to manage presence in applications where it is useful to detect how many clients are connected and when other clients disconnect.

要在Firestore中使用状态,您需要将Firestore与实时Firebase连接(没有其他方法).

To be able to use presence in firestore, you need to connect firestore with realtime firebase(no other way).

请检查以获取更多信息:

Please check this for more info:

https://firebase.google.com/docs/firestore/solutions/presence

这篇关于像实时数据库中一样,firestore中是否有类似onDisconnect()的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆