Skip to content Skip to sidebar Skip to footer

Mqtt In Aws Lambda Function For Alexa Javascript

Please help, I need to use mqtt protocol in lambda function to send some data to a broker. I use simple code to test it : mqtt = require('mqtt'); var client = mqtt.connect('mqtt:/

Solution 1:

First you will do in the directory of your project:

npm install mqtt --save

after you will zip this folder (inside the folder, the files and subdirectories) and upload to your lambda function.

Every time you must create a handler function, so you will create a function like this:

exports.handler  = function (event, context, callback) {
... your code...

}

in your lambda function at the AWS panel you will appoint to the file and the function you are using in Handler text field.

Post a Comment for "Mqtt In Aws Lambda Function For Alexa Javascript"