Last active
June 27, 2016 22:59
-
-
Save TheRyanBurke/89676f7a46ae9f33d0bcd4207e520533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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