1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mqttest/iotsubcli.js Thu Jun 04 14:50:33 2015 +0200 1.3 @@ -0,0 +1,17 @@ 1.4 +// Simple subscribe client 1.5 + 1.6 +//var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://test.mosquitto.org/'); 1.7 +//var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://192.168.42.250/'); 1.8 +var mqtt = require('mqtt'), locli = mqtt.connect('mqtt://raspeinz.local/'); 1.9 + 1.10 +locli.on('connect', function () { 1.11 + locli.subscribe('iotmsg'); 1.12 +}); 1.13 + 1.14 +locli.on('message', function(topic, message) { 1.15 + console.log(message.toString()); 1.16 + //locli.end(); 1.17 +}); 1.18 + 1.19 +// disable automatic reconnect 1.20 +locli.options.reconnectPeriod = 0;