Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/mqtt-level-store
Store your in-flight MQTT message on Level, for Node
https://github.com/mcollina/mqtt-level-store
Last synced: 12 days ago
JSON representation
Store your in-flight MQTT message on Level, for Node
- Host: GitHub
- URL: https://github.com/mcollina/mqtt-level-store
- Owner: mcollina
- License: mit
- Created: 2015-03-08T17:41:01.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-08-25T11:52:27.000Z (over 3 years ago)
- Last Synced: 2024-12-25T09:34:19.028Z (15 days ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 24
- Watchers: 7
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MQTT.js Level Store
Persistent Store for in-flight MQTT.js packets. Works in Node and the Browser thanks to [level](http://npm.im/level).
## Installation
`npm install mqtt-level-store --save`
## Usage
```js
'use strict';var mqtt = require('mqtt'),
levelStore = require('mqtt-level-store');
manager = levelStore('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();
});
});
```Note, `path/to/db` is a folder, not a file. Files will be created at the given path.
## License
MIT