How are unique clients identified by the presence feature?

To track unique clients, include a UUID with each subscribe request from a client (and cache it so it's consistent upon reconnects):[sub-key]/[channel]/[callback]/[timetoken]?uuid=[uuid]

For example:

All v3.2 SDKs and later, by default, generate a unique static UUID when instantiated. This is called the sessionUUID which is set by the Pubnub.uuid() method at instantiation. Subscribers append a URL parameter of ?uuid=SESSION_UUID, where SESSION_UUID is the instance's sessionUUID. PubNub associates the subscriber connection with that UUID.

In JavaScript, you can specify the UUID when initializing PUBNUB (either using PUBNUB.init() or a <div> tag). If you do not define the UUID, it will be generated automatically for you (according to uuid4 spec) and stored in either local storage or a cookie as the browser allows. If you are making your own RESTful subscribe call, you will need to append ?uuid=FOO URL parameter to the call, as explained above.

The sessionUUID can be any ASCII value. It does not have to follow the character pattern/rfc of a real UUID. PubNub accepts any ASCII string as a valid UUID value. More complicated UUIDs than a straight up ASCII value can be JSON-serialized then Base64-encoded. In summary, you can override sessionUUID values with your own and as long as they consist of ASCII characters, they can be used for channel presence functionality.

Note that when a client makes a here_now or presence call, the UUID is not required in the query. These calls only retrieve occupancy/uuid info. On a per-channel basis, the UUIDs retrieved by presence or here_now callbacks are the same UUIDs registered during subscribe calls.