2: We can use the JavaScript console to send a message to the broker/ host via:
i) Creating a new object "message" with the command:
message = new Paho.MQTT.Message("your message here")
ii) Including the topic in the property .destinationName
message.destinationName = "your_topic_here"
iii) Send the message with:
mqtt.send(message)
3: For a loop that send data every 1000 miliseconds, just put in the terminal the following:
setInterval(function () { d= Date(); message = new Paho.MQTT.Message(d); message.destinationName = "train_sensor" ;mqtt.send(message)}, 1000);