Chat - Amount of logged in users

Hi!

I am creating a chat and on the top, there is an indicator of how many of the users on the chat are logged in.
The Data is -

Conversation:
-members-list of users

How can I display the count of users that are logged in from the members list

Best,
Tomer

Hey there @tomerlan5

What I would do is to create a data type/thing that stores a number value, and then I’d set up a workflow that increments that number every time a user logs in, and another workflow that decrements that value every time a user logs out.

And regarding how to display the count, simply search for that data type and append :count to it

Yea but for example if i log in and then close the window the data type will still indicate i am active even though i am not

You can try this plugin to detect that action: Detect User Leaving Page Plugin | Bubble

It just detects when the mouse is out of the screen unfortunately

You could perhaps make your own implementation of displaying a popup that shows after an average user session has passed (e.g. 20 mins or whatever you see fit) and its purpose is to get confirmation from the user that their still active, and if no action is taken from the popup after several seconds, you could log out the user and decrement the value that shows active members.

This is just an idea I can think of, but if you find a better solution, it would be appreciated if you share it!

I’m afraid anything that confirms that the user is active would be bad practice in UX aspect

Maybe another option is to have a field called “last active date”, that is updated everytime the user performs an action. Then you can just do a search for users having a constraint "last active date+10min>current date. Of course you can adjust the minutes depending on your needs

This topic was automatically closed after 70 days. New replies are no longer allowed.