Quantcast
Channel: The Things Network - Latest posts
Viewing all articles
Browse latest Browse all 116893

Sodaq Tatu + LoRa Bee + GPS Bee, how to set up connection?

$
0
0

you could also write yourself a super simple nodejs app that gets the data (near realtime) from TTN's MQTT service

(don't forget to install the necessary npm module: npm install mqtt

var mqtt    = require('mqtt');
var client  = mqtt.connect('tcp://croft.thethings.girovito.nl:1883');
 
client.on('connect', function () {
  client.subscribe([
	'nodes/[your node's address]/packets',
	'nodes/[another address]/packets'
	]);
});

client.on('message', function (topic, message) {
  // message is Buffer .. now do what you want with it!, for example print it on the console like this:
  console.log('mqtt message:', message.toString());
});
client.on('connect', function(connack) { console.log('mqtt connack: ',connack); });
client.on('reconnect', function() { console.log('mqtt reconnected'); });
client.on('close', function() { console.log('mqtt closed'); });
client.on('offline', function() { console.log('mqtt offline'); });
client.on('error', function(err) { console.log('mqtt err: ',err); });

Viewing all articles
Browse latest Browse all 116893

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>