Comparing version 0.0.5 to 0.0.6
@@ -27,3 +27,3 @@ /** | ||
var APP_MON_RE = /^iot-2\/app\/(.+)\/mon$/; | ||
var SUPPORTED_CALLBACKS = ['deviceEvent', 'deviceCommand', 'deviceStatus', 'appStatus']; | ||
var SUPPORTED_CALLBACKS = ['deviceEvent', 'deviceCommand', 'deviceStatus', 'appStatus', 'disconnect']; | ||
@@ -68,2 +68,3 @@ var BROKER_PORT = 1883; | ||
this.subscriptionCount = 0; | ||
this.retryCount = 0; | ||
@@ -75,3 +76,3 @@ // tests should manually override these properties | ||
this.logger.trace("IoTAppClient constructed: " + this.appId+", "+this.apiKey+", "+this.apiToken+", "+this.orgId+", "+this.clientId); | ||
this.logger.trace("IoTAppClient constructed: " + this.appId + ", " + this.orgId + ", " + this.clientId); | ||
} | ||
@@ -94,3 +95,5 @@ | ||
username: this.apiKey, | ||
password: this.apiToken | ||
password: this.apiToken, | ||
reconnectPeriod: 1000 | ||
// keepalive: 10 | ||
}); | ||
@@ -102,2 +105,3 @@ | ||
this.mqttClient.on('connect',function(packet){ | ||
this.connected = true; | ||
self.logger.trace("CONNECTED......: \nSubscription Count = " + self.subscriptionCount); | ||
@@ -110,6 +114,19 @@ for(var count = 0 ; count < self.subscriptionCount ; count++) { | ||
} | ||
self.retryCount = 0; | ||
}); | ||
// client.subscribe('mytopic'); | ||
}); | ||
this.mqttClient.on('error', function(error){ | ||
self.logger.trace("\n\nError Error Error " + error); | ||
this.connected = false; | ||
}); | ||
this.mqttClient.on('close', function(){ | ||
self.retryCount++; | ||
self.logger.trace("Retry count = " + self.retryCount); | ||
if(self.retryCount <= 60 ) { | ||
self.mqttClient.options.reconnectPeriod = self.retryCount * 1000; | ||
} | ||
}); | ||
this.mqttClient.on('message', function(topic, payload){ | ||
@@ -116,0 +133,0 @@ self.logger.trace("mqtt: ", topic, payload); |
{ | ||
"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", | ||
"readmeFilename": "README.md", | ||
"name": "iotclient", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "This iotClient module can be used for developing node.js client code for IBM IoT Cloud Foundation.", | ||
@@ -17,5 +18,5 @@ "main": "application/IoTAppClient.js", | ||
}, | ||
"author": { | ||
"name": "Amit M Mangalvedkar, Tom Klapiscak, Sam Danbury" | ||
} | ||
"author": "Amit M Mangalvedkar <amitmangalvedkar@gmail.com>", | ||
"contributors" : [ { "name" : "Tom Klapiscak" }, { "name" : "Sam Danbury" } ], | ||
"license" : "Apache" | ||
} |
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
16524
4
379
4
29
3
1