how to implement user status online/offline & last online time.
- 0
- Flutter
- Databases
- Realtime
- Self Hosted
- Users

I'm working my Flutter project in which i need to show user status, if user is online then it should show it to other user, and if it's offline then offline like any other chat apps as well as last online time.


what is minimum amount of interval duration is needed for updating presence doc to keep user status active?

up to you, depending on your requirements. However, make sure not to hit the rate limit

like in firebase we do the same listen to event when it disconnects we make the user's status offline. and if user have unstable network then firebase wait for 60 seconds for user to connect back before making user offline.

so how realtime connection will handle the unstable connection?

the suggestion was not to use realtime...

oh, I see, okay. so there is a chance of inaccuracy without some kind of real-time connection.

cloud function cron job to check and update user presence based on your suggestion without using realtime can work, but will it be more expensive? cron job for all users every minute can make it almost realtime user presence,

No, function cron job was also not suggested

then what, please shower some light, i'm new here.

You might want to 👍🏼 this issue: https://github.com/appwrite/appwrite/issues/2418
For now, you can implement a heartbeat/pinging approach where the client sends a request every X interval to let the server know it's still around. After Y interval of no responses, the server would determine the user has left/disconnected
Recommended threads
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
- 1.7.0 Self Hosted Upgrade
Hi, I've tried a fresh install on 1.7.0 and I've also done a fresh install on 1.6.2. 1.6.2 is working fine fresh, update to 1.7.0 and migrate fails Fresh inst...
- Functions not work on Server only Localh...
Hi, I successfully upgraded from 1.4 to 1.7, but I'm having a problem. The functions no longer work with the settings I had. I assume some changes were made. It...
