SHARE
TWEET

muje

a guest Oct 15th, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mqtt = require('mqtt')
  2. var client = mqtt.connect('mqtt://test.mosquitto.org')
  3.  
  4. client.on('connect', function(){
  5.     client.publish('light','Light on')
  6. })
  7.  
  8. var mqtt = require('mqtt')
  9. var client = mqtt.connect('mqtt://test.mosquitto.org')
  10.  
  11. client.on('connect', function(){
  12.     client.subscribe('light')
  13. })
  14.  
  15. client.on('message', function(topic,message){
  16.     console.log(message.toString())
  17. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top