Messages are the actual packages of data that get published to channels. They can contain any serializable data, including objects, arrays, numbers, and strings. String content can include any UTF-8 character, single-byte and multi-byte. PubNub's maximum size for a single message is 32 KiB.
While messages can be in any format, JSON is usually the best choice. The data can be any serializable JSON object; the PubNub SDKs automatically stringify JSON objects before publishing. When you use JSON, the keys and values are up to you.
Associating data with a message
Just as you will store metadata about users and channels, you'll also want to store data related to messages. This could include metadata like the sender's name, tracking information, and reactions (such as emoji, or likes).
PubNub offers several message persistence options for historical retrieval.