Gathering detailed insights and metrics for aedes-persistence
Gathering detailed insights and metrics for aedes-persistence
Gathering detailed insights and metrics for aedes-persistence
Gathering detailed insights and metrics for aedes-persistence
npm install aedes-persistence
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
13 Stars
193 Commits
22 Forks
10 Watching
4 Branches
13 Contributors
Updated on 12 Jan 2024
JavaScript (93.74%)
TypeScript (6.26%)
Cumulative downloads
Total Downloads
Last day
1%
11,361
Compared to previous day
Last week
29.9%
58,185
Compared to previous week
Last month
51.6%
182,019
Compared to previous month
Last year
21.5%
1,451,703
Compared to previous year
2
The spec for an Aedes persistence, with abstract tests and a fast in-memory implementation.
To install aedes-persistence, simply use npm:
npm install aedes-persistence --save
persistence()
instance.storeRetained()
instance.createRetainedStream()
instance.createRetainedStreamCombi()
instance.addSubscriptions()
instance.removeSubscriptions()
instance.subscriptionsByClient()
instance.countOffline()
instance.subscriptionsByTopic()
instance.cleanSubscriptions()
instance.outgoingEnqueue()
instance.outgoingEnqueueCombi()
instance.outgoingUpdate()
instance.outgoingClearMessageId()
instance.outgoingStream()
instance.incomingStorePacket()
instance.incomingGetPacket()
instance.incomingDelPacket()
instance.putWill()
instance.getWill()
instance.delWill()
instance.streamWill()
instance.getClientList()
instance.destroy()
Creates a new instance of a persistence, that is already ready to operate. The default implementation is in-memory only.
Store a retained message, calls the callback when it was saved.
Return a stream that will load all retained messages matching the given pattern (according to the MQTT spec) asynchronously. Deprecated.
Return a stream that will load all retained messages matching given patterns (according to the MQTT spec) asynchronously.
Add the given offline subscriptions for the given
Client. The client must
have connected with clean: false
, as this is not checked here.
This is called when a client issue a SUBSCRIBE packet.
subscriptions
is in the same format of the subscribe
property in the
SUBSCRIBE packet:
1[{ 2 topic: 'hello/world', 3 qos: 1, 4}, { 5 topic: 'hello/#', 6 qos: 2, 7}]
The inverse of addSubscriptions
but subscriptions is an array of topic names.
Returns all the offline subscriptions for the given client. Called when
a client with clean: false
connects to restore its subscriptions.
subscriptions
is in the same format of the subscribe
property in the
SUBSCRIBE packet:
1[{ 2 topic: 'hello/world', 3 qos: 1, 4}, { 5 topic: 'hello/#', 6 qos: 2, 7}]
Returns the number of offline subscriptions and the number of offline clients.
Returns all the offline subscriptions matching the given pattern. Called when
a PUBLISH with qos: 1
or qos: 2
is received.
The subscriptions are in the format:
1{ 2 clientId: client.id, 3 topic: sub.topic, 4 qos: sub.qos 5}
Removes all offline subscriptions for a given client.
Enqueue a potentially offline delivery. subscription
is one of the
objects returned by subscriptionsByTopic
. Deprecated.
Enqueue a potentially offline delivery. subscriptions
is the whole subscriptions
objects returned by subscriptionsByTopic
.
Called before a (potentially) offline packet is delivered, the caller
should update the packet.messageId
before updating.
Removes a packet with the given messageId
(passing a PUBACK is ok)
from the persistence. Passes back original packet to the callback.
Return a stream that will load all offline messages for the given client asynchronously.
Store an incoming packet for the given client. Used for QoS 2.
Retrieve an incoming packet with the same messageId
for the given client. Used for QoS 2.
Deletes incoming packet with the same messageId
for the given client. Used for QoS 2.
Stores the will of a client. Used to support multi-broker environments and to not lose wills in case of a crash.
Retrieves the will of a client. Used to support multi-broker environments and to not lose wills in case of a crash.
Removes the will of a client. Used to support multi-broker environments and to not lose wills in case of a crash.
Streams all the wills for the given brokers. The brokers are in the format:
1{ 2 mybroker: { 3 brokerId: 'mybroker' 4 } 5}
Returns a stream which has all the clientIds subscribed to the specified topic
Destroy current persistence. Use callback cb(err)
to catch errors if any
A persistence needs to pass all tests defined in ./abstract.js. You can import and use that test suite in the following manner:
1const test = require('tape').test 2const myperst = require('./') 3const abs = require('aedes-persistence/abstract') 4 5abs({ 6 test: test, 7 persistence: myperst 8})
If you require some async stuff before returning, a callback is also supported:
1const test = require('tape').test 2const myperst = require('./') 3const abs = require('aedes-persistence/abstract') 4const clean = require('./clean') // invented module 5 6abs({ 7 test: test, 8 buildEmitter: require('mymqemitter'), // optional 9 persistence: function build (cb) { 10 clean(function (err) { 11 cb(err, myperst()) 12 }) 13 } 14})
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 14/25 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More