Skip to content

Commit c74749b

Browse files
noeroglesv
authored andcommitted
Add region tags to JWT refresh. (#974)
1 parent d0a3a3f commit c74749b

File tree

1 file changed

+2
-0
lines changed
  • iot/api-client/manager/src/main/java/com/example/cloud/iot/examples

1 file changed

+2
-0
lines changed

iot/api-client/manager/src/main/java/com/example/cloud/iot/examples/MqttExample.java

+2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public static void main(String[] args) throws Exception {
197197
options.messageType, i, options.numMessages, payload);
198198

199199
// Refresh the connection credentials before the JWT expires.
200+
// [START cloudiotcore_mqtt_jwt_refresh]
200201
long secsSinceRefresh = ((new DateTime()).getMillis() - iat.getMillis()) / 1000;
201202
if (secsSinceRefresh > (options.tokenExpMins * 60)) {
202203
System.out.format("\tRefreshing token after: %d seconds\n", secsSinceRefresh);
@@ -216,6 +217,7 @@ public static void main(String[] args) throws Exception {
216217
client.connect();
217218
attachCallback(client, options.deviceId);
218219
}
220+
// [END cloudiotcore_mqtt_jwt_refresh]
219221

220222
// Publish "payload" to the MQTT topic. qos=1 means at least once delivery. Cloud IoT Core
221223
// also supports qos=0 for at most once delivery.

0 commit comments

Comments
 (0)