Question related to a feature?

I want to track how many peoples are currently online in my app like: freecodecamp (Online(80): list of peoples are online), Any suggetions how I do this?

Hey there,

which ideas do you have about this?
What does an internet search bring up?


Currently I have 2 ideas:
1: Make whole server a room using and track every open connection and try to figure out which user is currently online.
2: Use session to track user online presence.