mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
3c31ef4643
commit
907ce5c079
@ -213,12 +213,12 @@ MQTTClient.prototype.publish = function(topic,payload,qos,retain) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
if (self.connected) {
|
if (self.connected) {
|
||||||
|
|
||||||
if (Buffer.isBuffer(payload)) {
|
if (!Buffer.isBuffer(payload)) {
|
||||||
payload = payload.toString();
|
if (typeof payload === "object") {
|
||||||
} else if (typeof payload === "object") {
|
payload = JSON.stringify(payload);
|
||||||
payload = JSON.stringify(payload);
|
} else if (typeof payload !== "string") {
|
||||||
} else if (typeof payload !== "string") {
|
payload = ""+payload;
|
||||||
payload = ""+payload;
|
}
|
||||||
}
|
}
|
||||||
var options = {
|
var options = {
|
||||||
topic: topic,
|
topic: topic,
|
||||||
|
Loading…
Reference in New Issue
Block a user