cool-iot – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | var mqtt = require('mqtt') |
2 | var client = mqtt.connect('mqtt://test.mosquitto.org') |
||
3 | |||
4 | client.on('connect', function () { |
||
5 | client.subscribe('presence') |
||
6 | client.publish('presence', 'Hello mqtt') |
||
7 | }) |
||
8 | |||
9 | client.on('message', function (topic, message) { |
||
10 | // message is Buffer |
||
11 | console.log(message.toString()) |
||
12 | client.end() |
||
13 | }) |