My setup looks like this:
In my local envirenment I have an OPC server which reads data from local OPC devices and send them to my local little server which then sends the data to the IoT-Hub on Azure (and there I save the data to the cosmosDB).
The local little server which communicates to the IoT-Hub on Azure looks like this:
var connectionString = '[IoT Hub device connection string]';
// use factory function from AMQP-specific package
var clientFromConnectionString = require('azure-iot-device-amqp').clientFromConnectionString;
// AMQP-specific factory function returns Client object from core package
var client = clientFromConnectionString(connectionString);
// use Message object from core package
var Message = require('azure-iot-device').Message;
var connectCallback = function (err) {
if (err) {
console.error('Could not connect: ' + err);
} else {
console.log('Client connected');
var msg = new Message('some data from my device');
client.sendEvent(msg, function (err) {
if (err) {
console.log(err.toString());
} else {
console.log('Message sent');
};
});
};
};
client.open(connectCallback);
How Can I make sure that this communication is secure?