ibm-watson-iot/iot-nodejs

ApplicationConfig.js: this.sharedSubscription is always falsy in getClientId()

jsuntiok opened this issue · 3 comments

We are looking for this.options.mqtt.sharedSubscription in constructor and we set that to false if it's not set.
No this.sharedSubscription is set.

Hey - I'll look into this for you.

There are the 2 primary ways to set your sharedSubscription to true by either using the environment variables
export WIOTP_OPTIONS_MQTT_SHAREDSUBSCRIPTION = true

or by including a .yaml file, eg:

  identity:
     appId: myApp
   auth:
     key: myKey
     token: myToken
   options:
     domain: internetofthings.ibmcloud.com
     mqtt:
       sharedSubscrption: true
       port: 8883
       transport: tcp
       cleanStart: false

Either way by default it will always be set to false if no value is provided.

let sharedSubs = process.env.WIOTP_OPTIONS_MQTT_SHAREDSUBSCRIPTION || "false";

Just so I can better understand where this issue lies, which of the 2 methods above did you use to set your sharedSubscription setting?

Answering using my other account.
I'm actually creating a ApplicationConfig instance and passing
{ mqtt: {sharedSubscription: true} }
as options.
So the instance should have the following:
instance.options.mqtt.sharedSubscription = true.
This seems to be the case with setting it via environment variable too.

However in getClientId()-method we check instance.sharedSubscription, which isn't set anywhere.

Ah I see now - thanks for bringing this up, I've corrected the call in getClientId() to "this.options.mqtt.sharedSubscription". Thanks again.