Can you elaborate on what you mean by "the number of people being online"? Do you mean the number of people who are looking at a particular web page at the same time? There is no way to know that (unless you want to ping the originating web site via AJAX as long as the page is open in a browser).
What you can do is keep track of the active sessions using a sessionListener. I have a sample app that does this. It also keeps track of the time remaining for each session and the login name for each of the session's users.