Skip to content

Commit

Permalink
improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Sep 20, 2023
1 parent 6ee1f61 commit b1fb482
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 2 additions & 4 deletions samples/node/fleet_provisioning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,26 +235,24 @@ async function main(argv: Args) {
var identity;
var timer;

console.log("Connecting...");
if (argv.mqtt5) {
client5 = common_args.build_mqtt5_client_from_cli_args(argv);
identity = iotidentity.IotIdentityClient.newFromMqtt5Client(client5);

const connectionSuccess = once(client5, "connectionSuccess");
console.log("Connecting...");
client5.start();

// force node to wait 60 seconds before killing itself, promises do not keep node alive
timer = setTimeout(() => { }, 60 * 1000);
await connectionSuccess;
console.log("Connected with Mqtt5 Client!");
identity = iotidentity.IotIdentityClient.newFromMqtt5Client(client5);

} else {
connection = common_args.build_connection_from_cli_args(argv);
identity = new iotidentity.IotIdentityClient(connection);

// force node to wait 60 seconds before killing itself, promises do not keep node alive
timer = setTimeout(() => { }, 60 * 1000);
console.log("Connecting...");
await connection.connect()
console.log("Connected with Mqtt3 Client!");
}
Expand Down
7 changes: 2 additions & 5 deletions samples/node/jobs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,19 @@ async function main(argv: Args) {
var client5;
var jobs;

console.log("Connecting...");
if (argv.mqtt5) {
client5 = common_args.build_mqtt5_client_from_cli_args(argv);
jobs = iotjobs.IotJobsClient.newFromMqtt5Client(client5);

const connectionSuccess = once(client5, "connectionSuccess");
console.log("Connecting...");
client5.start();

await connectionSuccess;
console.log("Connected with Mqtt5 Client!");
jobs = iotjobs.IotJobsClient.newFromMqtt5Client(client5);

} else {
connection = common_args.build_connection_from_cli_args(argv);
jobs = new iotjobs.IotJobsClient(connection);

console.log("Connecting...");
await connection.connect()
console.log("Connected with Mqtt3 Client!");
}
Expand Down
2 changes: 0 additions & 2 deletions samples/node/shadow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ async function main(argv: Args) {
shadow = iotshadow.IotShadowClient.newFromMqtt5Client(client5);

const connectionSuccess = once(client5, "connectionSuccess");

client5.start();

await connectionSuccess;
console.log("Connected with Mqtt5 Client...");
} else { // Build the mqtt3 based connection
Expand Down

0 comments on commit b1fb482

Please sign in to comment.