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

How to use Ascoltatori #173

Open
ghost opened this issue Apr 2, 2017 · 1 comment
Open

How to use Ascoltatori #173

ghost opened this issue Apr 2, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 2, 2017

Dear community
Recently, i am studying about Mosca mqtt + Ascoltatori and mongoDB.
I want to develop MongoDB to collect and store all data of other clients in Mosca mqtt. As i know that (Mosca + Ascoltatori) can meet this requirement. However, fields of data that are created by (Mosca + Ascoltatori) to store in MongoDB does not satisfy what i want to have. My ideal now is that i want to make MongoDB become as a Sub-Client of Mosca mqtt which sub all of topics and store data from the topics. I dont know whether Ascoltatori can help me or not because there is not much documents about how to to use it. Can i add a sub-client code inside ascoltatori.build() to subcriber and store all data into MongoDB ?
Thank you so much.

var ascoltatori = require('ascoltatori');
var settings = {
  type: 'mongo',
  url: 'mongodb://127.0.0.1/ascoltatori',
  pubsubCollection: 'ascoltatori',
  mongo: {} // mongo specific options
};

ascoltatori.build(settings, function (err, ascoltatore) {
  // ...
});
@mcollina
Copy link
Collaborator

mcollina commented Apr 2, 2017

if the connection details are the same of Mosca, there should be no problem. You will need to store all data in a different collection.

I suggest you do this in Mosca instead by listening to the 'published' event.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant