Class: Message


new Message(payload)

An application message, sent or received.

All attributes may be null, which implies the default values.

Name Type Description
payload String | ArrayBuffer The message data to be sent.

Name Type Description
payloadString string read only The payload as a string if the payload consists of valid UTF-8 characters.
payloadBytes ArrayBuffer read only The payload as an ArrayBuffer.

destinationName string mandatory The name of the destination to which the message is to be sent (for messages about to be sent) or the name of the destination from which the message has been received. (for messages received by the onMessage function).

qos number The Quality of Service used to deliver the message.
0 Best effort (default).
1 At least once.
2 Exactly once.

retained Boolean If true, the message is to be retained by the server and delivered to both current and future subscriptions. If false the server only delivers the message to current subscribers, this is the default for new Messages. A received message has the retained boolean set to true if the message was published with the retained boolean set to true and the subscrption was made after the message has been published.

duplicate Boolean read only If true, this message might be a duplicate of one which has already been received. This is only set on messages received from the server.