Presence works by sending messages when a user joins, leaves, or times out from a particular channel. You can listen for these messages to track who is in a channel, and how long since they did anything.
First, make sure each user as a UUID. Set this when you initialize PubNub:
var pubnub = PUBNUB...