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
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!
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