I have a running instance of ec2 with mosquitto broker installed on it . I am successfully able to connect with the broker from my webbrowser or any other internet connected devices. Code used from any other server.
const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://ec2-public-ip',{username:'username', password : 'password'},function(err){
console.log("Error" + err);
});
client.on('connect', () => {
client.publish('inTopic', '1')
console.log("published and subscribed Successfully")
}).
But when i am using the same code in lambda function . I am unable to publish the message . This is I am doing for Alexa Integration . I am suspecting : 1) Whether there is some problem with the port . Currently i am connecting using port 1883 2) Library is not supporting .
I am including the module package folder in the zip to upload on the lambda function. Any Help will be appreciable .
via Pravesh Bansal
No comments:
Post a Comment