As HTTP is stateless it's hard to tell when a user has disconnected, you can make the count more accurate by starting a session for each user then incrementing a "last_connected" timestamp by N seconds for each hit (can you tie this to each COMET update? Perhaps with JS?), then expiring any sessions that haven't been updated for a while. This is how a few popular CMS' (Drupal, Joomla) implement the "Who's Online" count.
As HTTP is stateless it's hard to tell when a user has disconnected, you can make the count more accurate by starting a session for each user then incrementing a "last_connected" timestamp by N seconds for each hit (can you tie this to each COMET update? Perhaps with JS?), then expiring any sessions that haven't been updated for a while. This is how a few popular CMS' (Drupal, Joomla) implement the "Who's Online" count.