Reputation: 53
I'm doing a social media project right now. Which I need to have user presence and it is very important. I have seen the methods onDisconnect()
and then making a user offline, but my main problem is that I am going Firestore for my project.
I want to update the Firestore users.id status to true or false. How can I do this method with useEffect()
and make online status or offline status?
I want to be willing to update in Firestore users.id
, not in the realtime database.
Upvotes: 3
Views: 1605
Reputation: 598847
Due to the way it communicates with its servers, Firestore doesn't have a built-in presence detection system. If you want to integrate a presence system into your Firestore project, you'll have to use the Realtime Database for this as shown in this documentation on building a presence system in Cloud Firestore.
There is a Firebase Extension in development that simplifies this integration down to a few clicks, but that is currently in early access and only available as part of the Firebase Alpha program, and I have no information on when it may become generally available.
Upvotes: 1