diff --git a/lib/units/device/plugins/solo.js b/lib/units/device/plugins/solo.js index d38ec108..1f5eeae4 100644 --- a/lib/units/device/plugins/solo.js +++ b/lib/units/device/plugins/solo.js @@ -1,3 +1,5 @@ +var crypto = require('crypto') + var syrup = require('stf-syrup') var logger = require('../../../util/logger') @@ -11,7 +13,16 @@ module.exports = syrup.serial() .dependency(require('./identity')) .define(function(options, sub, push, router, identity) { var log = logger.createLogger('device:plugins:solo') - var channel = wireutil.makePrivateChannel() + + // The channel should keep the same value between restarts, so that + // having the client side up to date all the time is not horribly painful. + function makeChannelId() { + var hash = crypto.createHash('sha1') + hash.update(options.serial) + return hash.digest('base64') + } + + var channel = makeChannelId() log.info('Subscribing to permanent channel "%s"', channel) sub.subscribe(channel)