Skip to content

Commit

Permalink
Added mqtt update subscription triggered on log
Browse files Browse the repository at this point in the history
  • Loading branch information
joyja committed Mar 23, 2020
1 parent e8c24b1 commit b1cf2e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/relations.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ MqttSource.prototype.log = async function(scanClassId) {
sql = `${sql} VALUES (?,?);`
params = [host.id, result.lastID]
await this.constructor.executeUpdate(sql, params)
this.pubsub.publish('mqttUpdate', { mqttUpdate: this.mqtt.service })
}
resolve()
})
Expand Down
2 changes: 2 additions & 0 deletions src/resolvers/Subscription/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const tag = require('./tag')
const mqttUpdate = require('./mqttUpdate')

module.exports = {
...mqttUpdate,
...tag
}
3 changes: 2 additions & 1 deletion src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,6 @@ type Mutation {
}

type Subscription {
tagUpdate: Tag
tagUpdate: Tag,
mqttUpdate: Service
}

0 comments on commit b1cf2e6

Please sign in to comment.