Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace shortid with hyperid #565 #567

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Client.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ a read-only flag indicates if client is closed or not.

## client.id

- `<string>` __Default__: `aedes_${shortid()}`
- `<string>` __Default__: `aedes_${hyperid()}`

Client unique identifier, specified by CONNECT packet.

Expand Down
4 changes: 2 additions & 2 deletions lib/handlers/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const write = require('../write')
const QoSPacket = require('../qos-packet')
const { through } = require('../utils')
const handleSubscribe = require('./subscribe')
const shortid = require('shortid')
const uniqueId = require('hyperid')()

function Connack (arg) {
this.cmd = 'connack'
Expand Down Expand Up @@ -75,7 +75,7 @@ function init (client, packet, done) {
return
}

client.id = clientId || 'aedes_' + shortid()
client.id = clientId || 'aedes_' + uniqueId()
client.clean = packet.clean
client.version = packet.protocolVersion
client._will = packet.will
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@
"fastfall": "^1.5.1",
"fastparallel": "^2.4.0",
"fastseries": "^2.0.0",
"hyperid": "^2.0.5",
"mqemitter": "^4.4.0",
"mqtt-packet": "^6.6.0",
"readable-stream": "^3.6.0",
"retimer": "^2.0.0",
"reusify": "^1.0.4",
"shortid": "^2.2.16",
"uuid": "^8.3.1"
}
}