Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #36 from mcollina/persistance
Browse files Browse the repository at this point in the history
Persistance Support
  • Loading branch information
mcollina committed Jun 26, 2013
2 parents ee6545a + 70bb77f commit e4d2aa6
Show file tree
Hide file tree
Showing 27 changed files with 3,432 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ results
npm-debug.log
node_modules
docs
mosquitto.db
4 changes: 3 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"beforeEach": false,
"describe": false,
"mosca": false,
"expect": false
"expect": false,
"before": false,
"moscaSettings": false
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ node_js:
services:
- rabbitmq
- redis-server
- mongodb
50 changes: 38 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ client.
## Features

* MQTT 3.1 compliant
* QoS 0 and QoS 1, but without storage
* QoS 0 and QoS 1
* Various storage options for QoS 1 offline packets,
and subscriptions.
* Built on top on node.js
* As fast as it is possible
* Usable inside ANY other node.js app, see the
Expand All @@ -52,20 +54,29 @@ client.
Mosca supports some command line options:

```
Usage: mosca [options]
Usage: mosca [options] [command]
Commands:
adduser <user> <pass> Add a user to the given credentials file
rmuser <user> Removes a user from the given credentials file
start start the server (optional)
Options:
-h, --help output usage information
-V, --version output the version number
-p, --port <n> the port to listen to
--parent-port <n> the parent port to connect to
--parent-host <s> the parent host to connect to
--parent-prefix <s> the prefix to use in the parent broker
-c, --config <c> the config file to use (override every
other options)
-v, --verbose set the bunyan log to INFO
--very-verbose set the bunyan log to DEBUG
-h, --help output usage information
-V, --version output the version number
-p, --port <n> the port to listen to
--parent-port <n> the parent port to connect to
--parent-host <s> the parent host to connect to
--parent-prefix <s> the prefix to use in the parent broker
--credentials <file> the file containing the credentials
--authorize-publish <pattern> the pattern for publishing to topics for the added user
--authorize-subscribe <pattern> the pattern for subscribing to topics for the added user
-c, --config <c> the config file to use (override every other option)
-d, --db <path> the path were to store the database
-v, --verbose set the bunyan log to INFO
--very-verbose set the bunyan log to DEBUG
```

However you can only use a MQTT backend with the command line options.
Expand Down Expand Up @@ -126,6 +137,21 @@ The patterns are checked and validated using
The credentials file can be automatically reladed by __Mosca__ if it
receives a `SIGHUP`.

## Persistance

The MQTT specification requires a persistent storage for offline QoS 1
subscription that has been done by an unclean client.
__Mosca__ offers several persitance options:

* [Memory](http://mcollina.github.com/mosca/docs/lib/persistance/memory.js.html),
* [LevelUp](http://mcollina.github.com/mosca/docs/lib/persistance/levelup.js.html),
* [Redis](http://mcollina.github.com/mosca/docs/lib/persistance/redis.js.html),
* [MongoDB](http://mcollina.github.com/mosca/docs/lib/persistance/mongo.js.html),

All of them can be configured from the configuration file, under the
`persistance` key. The only exception is LevelUp, which can be specified
by using the `--db` option from the command line.

## Contributing to Mosca

* Check out the latest master to make sure the feature hasn't been
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/single_pub_sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var mqtt = require("mqtt");

function setup(done) {

var client = mqtt.createClient(1883, "localhost", { clean: true });
var client = mqtt.createClient(1883, "localhost", { clean: program.clean });

client.on("connect", function () {
client.subscribe("hello", { qos: program.qos }, function () {
Expand Down Expand Up @@ -41,6 +41,7 @@ function bench(client, done) {
}

program
.option("--clean", "use clean clients")
.option("--header", "add header")
.option("-r, --runs <n>", "the number of runs to execute", parseInt, 10)
.option("-q, --qos <n>", "the QoS level (0, 1, 2)", parseInt, 0)
Expand Down
Loading

0 comments on commit e4d2aa6

Please sign in to comment.