Users are entities that connect to PubNub from client applications to exchange messages with other users. In the case of a chat application, users are actual people, or perhaps bots. In an IoT network, a user could be a device like a doorbell, a camera, or a temperature sensor.
A user is represented inside PubNub by a unique string called a UUID. You don't need to register UUIDs with PubNub—PubNub can accept any valid UUID, even if that UUID hasn't previously been sent to PubNub. Ensuring that each UUID uniquely identifies a user is your responsibility. For more information, refer to Connect to PubNub.
Don't use email addresses
Email addresses are too impermanent to use as user IDs. They also carry the potential for leakage of personal information.
Managing users and user data
PubNub users are a lightweight concept. If you want to provide persistent identities or associate data with users such as a display name or an avatar URL, it's your responsibility to register and authenticate users and provide storage for this information.
It's common to have an existing data store for user data and an existing user registration and sign in process. You can use your existing user management solution and easily integrate it with capabilities that PubNub provides. User lists, permissions, and registration remain under your control.
You can use data from your user management system, such as a display name, to augment messages handled by PubNub in your client application. For small amounts of data, you can even embed it into the sent message to avoid the need for the message receiver to look up the data.
A common use case for user-related storage is tracking the list of users that have joined a chat room. PubNub Presence will track which users are present in a channel and which users enter or leave the channel. However, tracking which users have joined the channel and aren't present is your responsibility, and requires a mechanism for storing this data.
When integrating with PubNub, you may want to associate the PubNub UUID with your own user identifier in your user storage system. It can also be useful to include your own user identifiers in sent messages to facilitate fetching data from your system later.