在Cloud Firestore中管理在线状态 [英] Managing Online Presence in Cloud Firestore

查看:87
本文介绍了在Cloud Firestore中管理在线状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firebase Realtime数据库中,我们可以通过保留对节点的引用并按如下所示进行更新来轻松管理用户的状态:

In Firebase Realtime Database, we can easily manage User presence by keeping a reference to a node and updating it as shown below:

DatabaseRef presenceRef = FirebaseDatabase.getInstance().getReference("disconnectmessage");

presenceRef.onDisconnect().setValue("I disconnected!");

如果我想在Cloud Firestore中做同样的事情,有什么办法可以实现? p>

If I want to do the same in Cloud Firestore, is there any way to achieve it?

推荐答案

您可以在同一项目中轻松使用Cloud Firestore和实时数据库。对于在线状态,我们建议您仍然使用实时数据库来处理它。

You can easily use both Cloud Firestore and Realtime Database in the same project. For presence, we recommend you still use the Realtime Database to handle it.

这篇关于在Cloud Firestore中管理在线状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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