Sending an empty payload using the MQTT.publish method
Hello. I'm using a publish method of the Services.MQTT class for sending downlink data using input form widget.(part of the code is shown below)
const MQTT = new Services({ token: context.token }).MQTT;
MQTT.publish(
{
bucket: bucketId,
message: JSON.stringify(dataToSend),
topic: "/test",
options
}
).then(context.log).catch(context.log);
This functionality is working perfectly fine while sending a non-empty payload, with the retain flag set as a true/false. But, I can't send an empty payload in any form in order to remove retained message. I was trying to send an empty string or a null value as a message, but keep getting errors that informs me that a message is invalid. I hope you could give me some more informations about the described issue.