How to display only online users on a screen?

Hello everyone,

I would like to display on my homepage only the profiles that are currently online but I can’t. Does anyone know how to do this?

Thanks for your valuable feedback!

Louis.

Hi @Louis33,

There is no built-in way to do such things in Adalo.
You could create a workaround:

  • add a field to Users collection, call it “Last activity time”
  • update this field when user does something in the app (for example, enters the chat screen)
  • Filter the list of users based on the value of this field (smth like if Current User → Last activity time is less then 5 minutes ago).

The downside of this solution is that it’ll cause a load on a DB, especially if there are many users and if your app will try to update last activity time frequently.

Note - I haven’t tried this solution in person, so implementation details might be a bit different, and I can’t guarantee it’ll work 100% :slight_smile:

Best regards, Victor.

1 Like

Hello Victor, thank you very much for your feedback it’s very cool ! I will try this solution then and hope it will work :slight_smile:

Thank you so much Victor !

Sorry but how do you do “last activity was less than 5 minutes ago”?

Hi @Louis33 ,

Check this thread.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.