Message = function (newPayload) {  
		var payload;
		if (   typeof newPayload === "string" 
			|| newPayload instanceof ArrayBuffer
			|| newPayload instanceof Int8Array
			|| newPayload instanceof Uint8Array
			|| newPayload instanceof Int16Array
			|| newPayload instanceof Uint16Array
			|| newPayload instanceof Int32Array
			|| newPayload instanceof Uint32Array
			|| newPayload instanceof Float32Array
			|| newPayload instanceof Float64Array
		   ) {
			payload = newPayload;
		} else {
			throw (format(ERROR.INVALID_ARGUMENT, [newPayload, "newPayload"]));
		}

		this._getPayloadString = function () {
			if (typeof payload === "string")
				return payload;
			else
				return parseUTF8(payload, 0, payload.length); 
		};

		this._getPayloadBytes = function() {
			if (typeof payload === "string") {
				var buffer = new ArrayBuffer(UTF8Length(payload));
				var byteStream = new Uint8Array(buffer); 
				stringToUTF8(payload, byteStream, 0);

				return byteStream;
			} else {
				return payload;
			};
		};

		var destinationName = undefined;
		this._getDestinationName = function() { return destinationName; };
		this._setDestinationName = function(newDestinationName) { 
			if (typeof newDestinationName === "string")
				destinationName = newDestinationName;
			else 
				throw new Error(format(ERROR.INVALID_ARGUMENT, [newDestinationName, "newDestinationName"]));
		};
				
		var qos = 0;
		this._getQos = function() { return qos; };
		this._setQos = function(newQos) { 
			if (newQos === 0 || newQos === 1 || newQos === 2 )
				qos = newQos;
			else 
				throw new Error("Invalid argument:"+newQos);
		};

		var retained = false;
		this._getRetained = function() { return retained; };
		this._setRetained = function(newRetained) { 
			if (typeof newRetained === "boolean")
				retained = newRetained;
			else 
				throw new Error(format(ERROR.INVALID_ARGUMENT, [newRetained, "newRetained"]));
		};
		
		var duplicate = false;
		this._getDuplicate = function() { return duplicate; };
		this._setDuplicate = function(newDuplicate) { duplicate = newDuplicate; };
	}
An application message, sent or received.
<p>
All attributes may be null, which implies the default values.

@name Paho.MQTT.Message
@constructor
@param {String|ArrayBuffer} payload The message data to be sent.
<p>
@property {string} payloadString <i>read only</i> The payload as a string if the payload consists of valid UTF-8 characters.
@property {ArrayBuffer} payloadBytes <i>read only</i> The payload as an ArrayBuffer.
<p>
@property {string} destinationName <b>mandatory</b> 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).
<p>
@property {number} qos The Quality of Service used to deliver the message.
<dl>
    <dt>0 Best effort (default).
    <dt>1 At least once.
    <dt>2 Exactly once.     
</dl>
<p>
@property {Boolean} retained 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. 
<p>
@property {Boolean} duplicate <i>read only</i> 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.