jeffminsungkim / Ashy

0 stars 0 forks source link

Re-implement user presence system for Cloud Firestore #22

Closed jeffminsungkim closed 6 years ago

jeffminsungkim commented 6 years ago

Objective Handle users’ online, offline and signout status

Unfortunately, Cloud Firestore does not support onDisconnect callback that I can use to listen for when the user disconnects from the database.

Reference Cloud Firestore Equivalent to Realtime Database “.info/connected” ref?

jeffminsungkim commented 6 years ago

All active connections to the database are listed in the /.info/connected collection in the Realtime database. Any time a client disconnects from the Realtime database, it is removed from this collection.

Firebase also offers another service called Cloud Functions. These functions can be triggered by

I've implemented Cloud Functions that listens to an onUpdate event in the Firebase Realtime database.