Skip to content

Commit

Permalink
Use uuid for broker id while shortid for client id
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Aug 11, 2019
1 parent 6b76ac2 commit 454d865
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aedes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var util = require('util')
var memory = require('aedes-persistence')
var parallel = require('fastparallel')
var series = require('fastseries')
var shortid = require('shortid')
var uuidv5 = require('uuid/v5')
var Packet = require('aedes-packet')
var bulk = require('bulk-write-stream')
var reusify = require('reusify')
Expand Down Expand Up @@ -37,12 +37,13 @@ function Aedes (opts) {

opts = Object.assign({}, defaultOptions, opts)

this.id = opts.id || shortid()
this.id = opts.id || uuidv5('https://github.com/mcollina/aedes', uuidv5.URL)
this.counter = 0
this.connectTimeout = opts.connectTimeout
this.mq = opts.mq || mqemitter(opts)
this.handle = function handle (conn) {
conn.setMaxListeners(opts.concurrency * 2)
// create a new Client instance for a new connection
// return, just to please standard
return new Client(that, conn)
}
Expand Down Expand Up @@ -245,8 +246,7 @@ Aedes.prototype.unsubscribe = function (topic, func, done) {
Aedes.prototype.registerClient = function (client) {
var that = this
if (this.clients[client.id]) {
// moving out so we wait for this, so we don't
// unregister a good client
// [MQTT-3.1.4-2]
this.clients[client.id].close(function closeClient () {
that._finishRegisterClient(client)
})
Expand Down

0 comments on commit 454d865

Please sign in to comment.