Firebase用户的在线状态 [英] Firebase user`s online status
本文介绍了Firebase用户的在线状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用包含firabase连接的移动应用程序.我想处理用户的在线状态.最初的想法是从应用程序设置状态:在线onAppStart和离线onClising,但是我们都知道该应用程序可能以错误的方式关闭,然后状态将不会被更新.
I'm making mobile app with include firabase connection. I'd like to handle user online status. First idea was to set status from app : online onAppStart and offline onClising, but we all known that app can be closed in wrong way, and then status wont be updated.
我发现了这样的东西:
firebase.database().ref(".info/connected");
如果我在firebase-function模块中的某个地方设置了它,它将按我的意愿工作吗?这是最好的选择吗?
Will it work as I want if i set this somewhere in firebase-function module? Is it the best options to do this?
推荐答案
我认为您正在实时数据库中寻找状态机制.
I think you are looking for the presence mechanism in the Realtime Database.
看看:
- 如何构建状态系统(Firebase博客)
- 在实时数据库中使用在线状态
- How To Build a Presence System (Firebase blog)
- Using presence in Realtime Database
这篇关于Firebase用户的在线状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文