simple-both.js 317 B

12345678910111213
  1. 'use strict'
  2. var mqtt = require('../..')
  3. var client = mqtt.connect()
  4. // or var client = mqtt.connect({ port: 1883, host: '192.168.1.100', keepalive: 10000});
  5. client.subscribe('presence')
  6. client.publish('presence', 'bin hier')
  7. client.on('message', function (topic, message) {
  8. console.log(message)
  9. })
  10. client.end()