You can subscribe to that publication to get a list of online contacts.
To track when a user drops out of a chat (ie. goes offline), you could observe changes on a cursor for that user, for example:
var observer = Meteor.users.find({_id: userIdToWatch, 'status.online': true}).observeChanges({
removed: function(id, document) {
// user has gone offline, do stuff
// stop this observer if you want
observer.stop();
}
});
Notify a user when another user initiates a chat
Again, you could observe changes on your chat collection for this. As an example: