aws-mqtt-client icon indicating copy to clipboard operation
aws-mqtt-client copied to clipboard

sessionToken

Open questsin opened this issue 8 years ago • 3 comments

where do you get the AWS session token from?

questsin avatar May 24 '17 00:05 questsin

AWS.config.credentials.sessionToken

just4give avatar Jun 29 '17 15:06 just4give

how we get aws config credential session token

Rajat07101994 avatar Sep 11 '17 08:09 Rajat07101994

my mqtt script is running but it not suscribe any topic of aws iot

const AWS = require('aws-sdk') const AWSMqtt = require('aws-mqtt') const WebSocket = require('ws')

AWS.config

AWS.config.region = 'us-east-1' // AWS.config.credentials = './cert/credentials'

debugger; const client = AWSMqtt.connect({ WebSocket: WebSocket, region: AWS.config.region, credentials: AWS.config.credentials, endpoint: 'a1qs749674of68.iot', // NOTE: get this value with aws iot describe-endpoint clientId: 'iotconsole-1484568658306-179514', // clientId to register with MQTT broker. Need to be unique per client },(error,connect)=>{ if(error) { console.log("error" +error); } if(connect) { console.log("data is connected",connect); } });

client.on('connect', () => { client.subscribe('/myTopic')

console.log("Topic is suscribed"); client.publish('/myTopic','i am here') }); client.on('message', (topic, message) => { console.log(topic, message) });

client.on('offline', () => { client.subscribe('/myTopic/off') client.publish('/myTopic/off','i am gone') }); but my script is connect and then disconnect it neither suscribe the topic nor it show an error message that error in correction

Rajat07101994 avatar Sep 11 '17 08:09 Rajat07101994