File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
iot/api-client/manager/src/main/java/com/example/cloud/iot/examples Expand file tree Collapse file tree 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 {
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 ("\t Refreshing 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.
You can’t perform that action at this time.
0 commit comments