function(packet) {
	this.updatePayload = function(packet) {
		this.p_previous = this.p;
		this.p = packet.payload;
		this.changed = this.p_previous != this.p;
		this.retained = packet.retain;
		this.lastChange = this.currentChange;
		this.currentChange = new Date();
	};

	this.changedFromTo = function(from, to) {
		return this.changed && this.p_previous == from && this.p == to;
	};
	this.changedTo = function(to) {
		return this.changed && this.p == to;
	};
	this.changedFrom = function(from) {
		return this.changed && this.p_previous == from;
	};

	this.t = packet.topic;
	this.updatePayload(packet);
	this.currentChange = new Date();
	this.lastChange = undefined;

	//aliases
	this.payload = this.p;
	this.topic = this.t;
}
function(packet) {
	this.updatePayload = function(packet) {
		this.p_previous = this.p;
		this.p = packet.payload;
		this.changed = this.p_previous != this.p;
		this.retained = packet.retain;
		this.lastChange = this.currentChange;
		this.currentChange = new Date();
	};

	this.changedFromTo = function(from, to) {
		return this.changed && this.p_previous == from && this.p == to;
	};
	this.changedTo = function(to) {
		return this.changed && this.p == to;
	};
	this.changedFrom = function(from) {
		return this.changed && this.p_previous == from;
	};

	this.t = packet.topic;
	this.updatePayload(packet);
	this.currentChange = new Date();
	this.lastChange = undefined;

	//aliases
	this.payload = this.p;
	this.topic = this.t;
}
function ( packet ) { this . updatePayload = function ( packet ) { this . p_previous = this . p ; this . p = packet . payload ; this . changed = this . p_previous != this . p ; this . retained = packet . retain ; this . lastChange = this . currentChange ; this . currentChange = new Date ( ) ; } ; this . changedFromTo = function ( from , to ) { return this . changed && this . p_previous == from && this . p == to ; } ; this . changedTo = function ( to ) { return this . changed && this . p == to ; } ; this . changedFrom = function ( from ) { return this . changed && this . p_previous == from ; } ; this . t = packet . topic ; this . updatePayload ( packet ) ; this . currentChange = new Date ( ) ; this . lastChange = undefined ; //aliases this . payload = this . p ; this . topic = this . t ; }
Constructor for the message class
Constructor for the message class