Comparing version 0.0.4 to 0.0.5
@@ -65,2 +65,5 @@ /** | ||
this.subscriptions = {}; | ||
this.subscriptionCount = 0; | ||
// tests should manually override these properties | ||
@@ -94,2 +97,15 @@ this.brokerHost = this.orgId + ".messaging.internetofthings.ibmcloud.com"; | ||
var self = this; // for referencing "this" from inside nested function definition | ||
this.mqttClient.on('connect',function(packet){ | ||
self.logger.trace("CONNECTED......: \nSubscription Count = " + self.subscriptionCount); | ||
for(var count = 0 ; count < self.subscriptionCount ; count++) { | ||
self.logger.trace((count + 1) + "\t" + self.subscriptions[count] ); | ||
self.checkMqtt(); | ||
self.logger.trace("Resubscribing: "); | ||
self.mqttClient.subscribe(self.subscriptions[count], {qos: 0}); | ||
} | ||
// client.subscribe('mytopic'); | ||
}); | ||
this.mqttClient.on('message', function(topic, payload){ | ||
@@ -171,2 +187,5 @@ self.logger.trace("mqtt: ", topic, payload); | ||
this.mqttClient.subscribe(topic, {qos: 0}); | ||
this.subscriptions[this.subscriptionCount] = topic; | ||
this.subscriptionCount++; | ||
this.logger.trace("Freshly Subscribed to: " + this.subscriptions[this.subscriptionCount - 1]); | ||
return this; | ||
@@ -173,0 +192,0 @@ }; |
{ | ||
"readme": "This iotclient module can be used in an app to connect to IBM IoT Cloud.\n\nIt contains multiple callbacks to make an app subscribe to \nDevice Event, \nDevice Command, \nDevice Status and \nApplication Status.\nIt can also be used to publish, \nDevice Events, on the behalf of a device and \nDevice Commands. \n\nThis can be used for both \nQuickstart and \n Registered flow", | ||
"name": "iotclient", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "This iotClient module can be used for developing node.js client code for IBM IoT Cloud Foundation.", | ||
@@ -6,0 +6,0 @@ "main": "application/IoTAppClient.js", |
14640
364