aboutsummaryrefslogtreecommitdiff
path: root/src/mqtt
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-11-16 18:46:56 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-11-16 18:46:56 +0100
commitdda9ef2ae7971bceaa792e328c8489cb0695b77e (patch)
treef4ce29c170dbd4af136418949a857eb9e89154ca /src/mqtt
parentf17922bcafe1f2f369c9be0f236570771c8ab214 (diff)
downloaddiller-server-dda9ef2ae7971bceaa792e328c8489cb0695b77e.tar.gz
diller-server-dda9ef2ae7971bceaa792e328c8489cb0695b77e.tar.bz2
diller-server-dda9ef2ae7971bceaa792e328c8489cb0695b77e.tar.xz
diller-server-dda9ef2ae7971bceaa792e328c8489cb0695b77e.zip
core:
o Adding device_status table containing the latest device status. mqtt: o Listening on $SYS/broker/log, parse out messages about clients connecting and disconnecting and store in database.
Diffstat (limited to 'src/mqtt')
-rw-r--r--src/mqtt/DillerMqttClient.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mqtt/DillerMqttClient.js b/src/mqtt/DillerMqttClient.js
index 62f5aef..b9cf01b 100644
--- a/src/mqtt/DillerMqttClient.js
+++ b/src/mqtt/DillerMqttClient.js
@@ -12,7 +12,7 @@ function DillerMqttClient(config, tx) {
var mqttClient;
var hostname = os.hostname();
- function run(clientType) {
+ function run(clientType, subscribeToLog) {
if (mqttClient) {
throw 'Already connected';
}
@@ -36,6 +36,9 @@ function DillerMqttClient(config, tx) {
mqttClient.on('connect', function () {
log.info('Connected');
mqttClient.subscribe('/diller/#');
+ if (subscribeToLog) {
+ mqttClient.subscribe('$SYS/broker/log/#');
+ }
});
}