Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mqtt = require('mqtt');
- var client = mqtt.connect('mqtt://127.0.0.1:1883',{
- username: 'xxxx',
- password: 'xxxx'
- });
- client.on('connect', function (err,done) {
- if(err){
- console.log(err)
- }else{
- console.log("Connected...")
- client.subscribe('test');
- }
- })
- client.on('message', function (topic, message) {
- // want to get the header details here.
- })
Add Comment
Please, Sign In to add comment