Messages are the actual packets 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 multibyte. Our maximum size for any single message is 32KB.

The message doesn’t have to be formatted as JSON, but we recommend it. It can also be any object, as long as it can be serialized; PubNub SDKs will automatically stringify JSON objects prior to publishing. Most developers use the JSON format, and the keys and values are completely up to you.

Here is an example of a JSON message: {"from":"user123", "message": "Hello, how are you?"}.

Try PubNub Today

Connect up to 100 devices for Free