migrated from Bugzilla #440770
status RESOLVED severity normal in component MQTT-JS for 1.1
Reported in version 1.0 on platform All
Assigned to: Tang Zi Han
On 2014-07-30 09:07:00 -0400, Karl Palsson wrote:
The "Message" object is quite useful in the received case, containing information about length, topic, dup flag, and helpers to get the payload in multiple formats.
For publishing however, it's an obstacle.
To send a message, you are required to make the following calls..
var m = new Paho.MQTT.Message("some payload");
m.destinationName = "bulky/code/is/better/right";
m.qos = 2;
m.retain = true;
mqclient.send(m);
There's no reason for this at publish time. The only options available at publish time are qos, retain flag, topic and payload. If we can't simply have a publish method that accepts all these parameters. (with only topic and payload being required) can we at least have a better constructor?
either
mqclient.send(topic, payload, qos=0, retain=false)
or
mqclient.send(new Paho.MQTT.Message("topic", "payload"))
I presume the second form wouldn't work, as the existing constructor puts the payload first, but really, anything would be an improvement. If we can't put hardcoded defaults on qos and retain flag, they could be client creation time options, if necessary.
On 2014-08-11 01:46:22 -0400, Tang Zi Han wrote:
It's better to add a new API,
such as
mqclient.publish(topic, publishOptions)
publishOptions = {
payload: "TEST",
qos : 0,
retain: false
}
migrated from Bugzilla #440770 status RESOLVED severity normal in component MQTT-JS for 1.1 Reported in version 1.0 on platform All Assigned to: Tang Zi Han
On 2014-07-30 09:07:00 -0400, Karl Palsson wrote:
On 2014-08-11 01:46:22 -0400, Tang Zi Han wrote:
On 2014-08-31 22:27:44 -0400, Tang Zi Han wrote: