What is the proper way of sending HTML to a user via a PubNub message?

PubNub can send raw HTML to a user as long as the HTML is encoded in the message as a string. String content can include any UTF-8 character single-byte and multi-byte.

If using the Python client API, make sure you do not send special Python classes or functions as those will not serialize. Incorrectly encoding the message is likely to result in the following error message:

is not JSON serializable

Note that total message size can not exceed 32KB.

See general description of the data types that messages can contain.