Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mqtt = require('mqtt');
- var options = {
- username: 'try',
- password: 'try'
- }
- var client = mqtt.connect('mqtt://broker.shiftr.io', options);
- client.on('connect', function() {
- client.subscribe("thebestpets");
- client.publish("thebestpets/dogs", "Dogs are really great");
- })
- client.on("message", function (topic, message) {
- console.log(message.toString())
- })
Add Comment
Please, Sign In to add comment