Created
January 15, 2016 16:30
-
-
Save dpjanes/c6f599c8327e31e49c6d to your computer and use it in GitHub Desktop.
Send IOTDB things to MQTT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
make sure to | |
homestar install iotdb-transport-mqtt | |
homestar install iotdb-transport-iotdb | |
(npm install will probably work too) | |
Further reading on transporter | |
https://homestar.io/about/transporters | |
*/ | |
var iotdb = require('iotdb'); | |
// this puts all your IOTDB things into a transporter | |
var things = iotdb.connect(); | |
var IOTDBTransporter = require('iotdb-transport-iotdb').Transport; | |
var iotdb_transporter = new IOTDBTransporter(things); | |
// this sets up a blank MQTT transporter | |
var MQTTTransporter = require('iotdb-transport-mqtt').Transport; | |
var mqtt_transporter = new MQTTTransporter({ | |
host: "127.0.0.1", // my mosquitto | |
}); | |
// this sends everything inside of IOTDB to the MQTT transporter | |
iotdb_transporter.push_to(mqtt_transporter); | |
// note if you're clever, you can send to Express, Firebase, &c | |
// at some point in the future there will be a COAP transporter | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you could also do
things = iotdb.things()
if you're doing setup elsewhere