Guest User

Untitled

a guest
Jul 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. var DeviceClient = require('azure-iot-device').Client
  2. var DeviceProtocol = require('azure-iot-device-amqp').AmqpWs
  3.  
  4. [...]
  5.  
  6. var connectionString = "HostName=.....";
  7.  
  8. [...]
  9.  
  10. var client = DeviceClient.fromConnectionString(connectionString, DeviceProtocol);
  11.  
  12. [...]
  13.  
  14. client.on('message', onMessage);
  15.  
  16. function onMessage(msg) {
  17. console.log('Id: ' + msg.messageId + ' Body: ' + msg.data);
  18. messageController.exec(JSON.parse(msg.data.toString()));
  19. client.complete(msg, printResultFor('completed'));
  20. }
Add Comment
Please, Sign In to add comment