|
1 // Simple subscribe client |
|
2 |
|
3 //var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://test.mosquitto.org/'); |
|
4 //var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://192.168.42.250/'); |
|
5 var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://raspeinz.local/'); |
|
6 |
|
7 locli.on('connect', function () { |
|
8 locli.subscribe('iotmsg'); |
|
9 }); |
|
10 |
|
11 locli.on('message', function(topic, message) { |
|
12 console.log(message.toString()); |
|
13 //locli.end(); |
|
14 }); |
|
15 |
|
16 // disable automatic reconnect |
|
17 locli.options.reconnectPeriod = 0; |