Skip to content

Instantly share code, notes, and snippets.

@TheRyanBurke
Last active June 27, 2016 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheRyanBurke/89676f7a46ae9f33d0bcd4207e520533 to your computer and use it in GitHub Desktop.
Save TheRyanBurke/89676f7a46ae9f33d0bcd4207e520533 to your computer and use it in GitHub Desktop.
var sdk = require('aws-iot-device-sdk');
var shadow = sdk.thingShadow({
keyPath: 'certs/private.pem.key',
certPath: 'certs/certificate.pem.crt',
caPath: 'certs/root-CA.crt',
clientId: 'rmb-cid',
region: 'us-east-1'
});
var clientTokenUpdate;
console.log('connecting to service')
shadow.on('connect', function() {
console.log('connected to service')
shadow.register('asdf');
setTimeout(function() {
var state = {
"state": {
"desired": {
"red":100
}
}
};
clientTokenUpdate = shadow.update('asdf', state);
if(clientTokenUpdate === null) {
console.log('update failed');
}
}, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment