Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/behrad/mqtt-nedb-store
NeDB store for in-flight MQTT.js packets.
https://github.com/behrad/mqtt-nedb-store
inflight mqtt nedb persistence
Last synced: about 2 months ago
JSON representation
NeDB store for in-flight MQTT.js packets.
- Host: GitHub
- URL: https://github.com/behrad/mqtt-nedb-store
- Owner: behrad
- License: mit
- Created: 2017-05-30T06:45:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-23T08:22:06.000Z (almost 5 years ago)
- Last Synced: 2024-11-03T08:33:29.292Z (about 2 months ago)
- Topics: inflight, mqtt, nedb, persistence
- Language: JavaScript
- Size: 8.79 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MQTT.js NeDB Store
NeDB Store for in-flight MQTT.js packets. Thanks to [nedb](https://github.com/louischatriot/nedb).
## Usage
```js
'use strict';var mqtt = require('mqtt'),
NeDBStore = require('mqtt-nedb-store'),
manager = NeDBStore('path/to/db');var client = mqtt.connect({
port: 8883,
incomingStore: manager.incoming,
outgoingStore: manager.outgoing
});//// or
// var client = mqtt.connect('mqtt://test.mosca.io', {
// port: 8883,
// incomingStore: manager.incoming,
// outgoingStore: manager.outgoing
//});client.on('connect', function() {
console.log('connected');
client.publish('hello', 'world', {qos: 1}, function() {
console.log('published');
client.end();
});
});
```## Automatic compaction
NeDB datastores are compacted by default only when opened. NeDB's automatic
periodic compaction can be activated with NeDB constructor options:```
manager = NeDBStore('path/to/db', { outgoing: { autocompactionInterval: 60 } });
```## License
MIT