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

fix: options missing when called storage backend #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: options missing when called storage backend #630

wants to merge 1 commit into from

Conversation

eljefedelrodeodeljefe
Copy link

Currently when you call the example redis implementations, I believe the options won't get passed through. You can easily miss this locally, as redis for example is just calling its defaults. However, setting password is silent fail.

The expectation from the redis example is that all options from the ascoltatore object gets passed down.

Though this fix fixed the redis problem I would maybe rather recommend modernisation around inheritance and option passing. But I know you know what best to do. I offer my help, as I am currently doing a lot with MQTT in a my day job.

Example:

var mosca = require('./')

var ascoltatore = {
  type: 'redis',
  redis: require('redis'),
  db: 12,
  port: 6379,
  return_buffers: true, // to handle binary payloads
  host: "localhost",
  password: 'hello'
};

var moscaSettings = {
  port: 1883,
  backend: ascoltatore,
  persistence: {
    factory: mosca.persistence.Redis
  }
};

var server = new mosca.Server(moscaSettings);
server.on('ready', setup);

server.on('clientConnected', function(client) {
	console.log('client connected', client.id);
});

// fired when a message is received
server.on('published', function(packet, client) {
  console.log('Published', packet.topic, packet.payload);
});

// fired when the mqtt server is ready
function setup() {
  console.log('Mosca server is up and running')
}

@eljefedelrodeodeljefe
Copy link
Author

Currently fails due to missing backend object in some cases. Gonna be on vacation during the week. If you like to drive this forward I am gonna fix it Friday.

@mcollina
Copy link
Collaborator

I'm on vacation for the next two weeks myself.

@eljefedelrodeodeljefe
Copy link
Author

eljefedelrodeodeljefe commented Apr 17, 2017 via email

@mcollina
Copy link
Collaborator

mcollina commented May 2, 2017

CI is failing everywhere: https://travis-ci.org/mcollina/mosca/jobs/222653523#L1440.

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

Successfully merging this pull request may close these issues.

2 participants