Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public static void main(String[] args) throws Exception {
options.messageType, i, options.numMessages, payload);

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

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