Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add clientId so that it can connect using auto created policy,… #539

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 4 additions & 3 deletions samples/node/pub_sub_mqtt5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ yargs.command('*', false, (yargs: any) => {
})
}, main).parse();

function creatClientConfig(args : any) : mqtt5.Mqtt5ClientConfig {
function createClientConfig(args : any) : mqtt5.Mqtt5ClientConfig {
let builder : iot.AwsIotMqtt5ClientConfigBuilder | undefined = undefined;

if (args.key && args.cert) {
Expand All @@ -62,15 +62,16 @@ function creatClientConfig(args : any) : mqtt5.Mqtt5ClientConfig {
}

builder.withConnectProperties({
keepAliveIntervalSeconds: 1200
keepAliveIntervalSeconds: 1200,
clientId: 'sdk-nodejs-v2-pub-sub-mqtt5'
});

return builder.build();
}

function createClient(args: any) : mqtt5.Mqtt5Client {

let config : mqtt5.Mqtt5ClientConfig = creatClientConfig(args);
let config : mqtt5.Mqtt5ClientConfig = createClientConfig(args);

console.log("Creating client for " + config.hostName);
let client : mqtt5.Mqtt5Client = new mqtt5.Mqtt5Client(config);
Expand Down