Send heartbeats from the provider. This keeps unauthorized and offline devices present as well, which is what we want. This also greatly reduces the number of queries to rethinkdb.

This commit is contained in:
Simo Kinnunen
2014-06-02 14:51:26 +09:00
parent 2dda82253d
commit bebb3af42a
8 changed files with 37 additions and 40 deletions

View File

@@ -1,20 +0,0 @@
var syrup = require('syrup')
var wire = require('../../../wire')
var wireutil = require('../../../wire/util')
module.exports = syrup.serial()
.dependency(require('../support/push'))
.define(function(options, push) {
function heartbeat() {
push.send([
wireutil.heartbeat
, wireutil.envelope(new wire.DeviceHeartbeatMessage(
options.serial
))
])
setTimeout(heartbeat, options.heartbeatInterval)
}
heartbeat()
})