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 Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ public static void main(String[] args) throws Exception {
197
197
options .messageType , i , options .numMessages , payload );
198
198
199
199
// Refresh the connection credentials before the JWT expires.
200
+ // [START cloudiotcore_mqtt_jwt_refresh]
200
201
long secsSinceRefresh = ((new DateTime ()).getMillis () - iat .getMillis ()) / 1000 ;
201
202
if (secsSinceRefresh > (options .tokenExpMins * 60 )) {
202
203
System .out .format ("\t Refreshing token after: %d seconds\n " , secsSinceRefresh );
@@ -216,6 +217,7 @@ public static void main(String[] args) throws Exception {
216
217
client .connect ();
217
218
attachCallback (client , options .deviceId );
218
219
}
220
+ // [END cloudiotcore_mqtt_jwt_refresh]
219
221
220
222
// Publish "payload" to the MQTT topic. qos=1 means at least once delivery. Cloud IoT Core
221
223
// also supports qos=0 for at most once delivery.
You can’t perform that action at this time.
0 commit comments