How to show if users are online

For realtime status you can use websockets. Maybe check the following topic: