moscajs / mosca

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

Question about subscriptions and ttl #675

Closed scramble45 closed 6 years ago

scramble45 commented 6 years ago

What happens to subscriptions that the client is subscribed to after 30 days ttl, how can they get renewed, does just reconnecting to them renew them? Seems like before I put a subscription ttl they expired and on reconnect on the packets that were waiting for the clients never got to the recipients. Now I am wondering if I will run into the same problem after 30days the client will still be publishing fine but the subscriptions will be expired and they wont be listening for anything new.

Example of my mosca redis settings:

var serverSettings = {
  port: 1883,                  //default port is 1883 for mqtt
  backend: dbSettings,         //database sttings we have created earlier
  http: {
  port: 3000,
  bundle: true,
  static: './public',
  stats: true
  },
  persistence: {
        factory: mosca.persistence.Redis,
        host: 'localhost',
        port: 6379,
        db: 2,
        ttl: {
        packets: 30 * 24 * 60 * 60 * 1000, // 30 days
        subscriptions: 30 * 24 * 60 * 60 * 1000 // 30 days
      }
  }
}
mcollina commented 6 years ago

You will have to reissue a subscribe from the client.

I would recommend to use https://github.com/mcollina/aedes and https://github.com/mcollina/aedes-persistence-redis. It does not expire the subscriptions and it is more actively developed.

scramble45 commented 6 years ago

Thanks I will give that a shot.