mqttest/iotsubcli.js

changeset 0
e8ccd40d0ef6
equal deleted inserted replaced
-1:000000000000 0:b7387d93c2e6
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;

mercurial