aedes-persistence-nedb

2.0.3 • Public • Published

Travis Azure Pipelines Codacy Badge Dependencies Known Vulnerabilities Greenkeeper badge js-standard-style

aedes-persistence-nedb

Aedes persistence, backed by NeDB.

See aedes-persistence for the full API, and Aedes for usage.

Install

npm i aedes aedes-persistence-nedb --save

API

Persistence (options)

Creates a new instance of aedes-persistence-nedb. Accepts an options object to override defaults.

var NedbPersistence = require('aedes-persistence-nedb');
var persistence = new NedbPersistence({
  path: './db'      // defaults to './data',
  prefix: 'mqtt'    // defaults to ''
});

Example

Creates a new Aedes instance that persists to NeDB. Connect to this instance with a MQTT client to see it working.

var NedbPersistence = require('aedes-persistence-nedb');
var Aedes = require('aedes');
var net = require('net');
 
var db = new NedbPersistence();
var aedes = Aedes({ persistence: db });
var server = net.createServer(aedes.handle);
var port = 1883;
 
server.listen(port, function () {
  console.log('server listening on port', port);
});

Maintainers

Osmond van Hemert Github Web

Contributing

See the CONTRIBUTING file for details.

License

MIT

Package Sidebar

Install

npm i aedes-persistence-nedb

Weekly Downloads

114

Version

2.0.3

License

MIT

Unpacked Size

55.2 kB

Total Files

13

Last publish

Collaborators

  • ovhemert