Created
July 15, 2018 20:48
-
-
Save jamesbulpin/ed068edb4b09e637c6564a5224614e3d 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 DeviceClient = require('azure-iot-device').Client | |
var DeviceProtocol = require('azure-iot-device-amqp').AmqpWs | |
[...] | |
var connectionString = "HostName=....."; | |
[...] | |
var client = DeviceClient.fromConnectionString(connectionString, DeviceProtocol); | |
[...] | |
client.on('message', onMessage); | |
function onMessage(msg) { | |
console.log('Id: ' + msg.messageId + ' Body: ' + msg.data); | |
messageController.exec(JSON.parse(msg.data.toString())); | |
client.complete(msg, printResultFor('completed')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment