moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

cannot receive retain message #591

Closed TangMonk closed 7 years ago

TangMonk commented 7 years ago

In embedded cannot work, this following is the code:

const pubsubsettings = {
  type: 'redis',
  db: 12,
  port: 6379,
  return_buffers: true,
  host: "localhost",
  redis: require('ioredis')
};

const moscaSettings = {
  port: 1883,
  backend: pubsubsettings
};

const server = new mosca.Server(moscaSettings);

But works in standalone mode mosca -v | pino

mcollina commented 7 years ago

You need to set a persistence as well: https://github.com/mcollina/mosca/blob/master/test/server_redis.js#L33-L35