Guest User

Untitled

a guest
Apr 13th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. var mqtt = require('mqtt');
  2. var client = mqtt.connect('mqtt://127.0.0.1:1883',{
  3. username: 'xxxx',
  4. password: 'xxxx'
  5. });
  6. client.on('connect', function (err,done) {
  7. if(err){
  8. console.log(err)
  9. }else{
  10. console.log("Connected...")
  11. client.subscribe('test');
  12. }
  13. })
  14. client.on('message', function (topic, message) {
  15. // want to get the header details here.
  16. })
Add Comment
Please, Sign In to add comment