I'm facing an issue with sending an array of data from my node to the MQTT server.
Although I have a receive function that is working fine, I'm unable to get it working in the opposite direction.
var message = new Array();
message[0] = 108;
message[1] = 11;
client.publish("/topic", message, {
retain: false,
qos: 0
});
However, I keep receiving the following error:
[ERROR] TypeError: invalid data
I'm unsure of how to properly declare the array in order to populate it with data and send it. In my receive function, the message variable is passed as an argument and I can access it as an array: message[x]...