Skip to content

Commit

Permalink
Add region tags to JWT refresh. (#544)
Browse files Browse the repository at this point in the history
* Add region tags to JWT refresh.
  • Loading branch information
noerog authored and gguuss committed Jan 3, 2018
1 parent 1af0e36 commit 7957364
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions iot/mqtt_example/cloudiot_mqtt_example_nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function publishAsync (messageCount, numMessages) {
if (messageCount < numMessages) {
// If we have published fewer than numMessage messages, publish payload
// messageCount + 1 in 1 second.
// [START iot_mqtt_jwt_refresh]
setTimeout(function () {
let secsFromIssue = parseInt(Date.now() / 1000) - iatTime;
if (secsFromIssue > argv.tokenExpMins * 60) {
Expand Down Expand Up @@ -169,6 +170,7 @@ function publishAsync (messageCount, numMessages) {
}
publishAsync(messageCount + 1, numMessages);
}, delayMs);
// [END iot_mqtt_jwt_refresh]
} else {
// Otherwise, close the connection.
console.log('Closing connection to MQTT. Goodbye!');
Expand Down

0 comments on commit 7957364

Please sign in to comment.