firestore 中有没有像 onDisconnect() 这样的方法,就像在实时数据库中一样? [英] Is there any method like onDisconnect() in firestore like there is in realtime database?

查看:15
本文介绍了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:

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天全站免登陆