Skip to content

Instantly share code, notes, and snippets.

@ThomasPe

ThomasPe/app.js Secret

Created September 8, 2020 08:05
Show Gist options
  • Save ThomasPe/e7bddf8a226f0c539a9e57f151f5ef27 to your computer and use it in GitHub Desktop.
Save ThomasPe/e7bddf8a226f0c539a9e57f151f5ef27 to your computer and use it in GitHub Desktop.
IdentityTranslationModule init
ModuleClient.fromEnvironment(Transport, function (err, moduleClient) {
if (err) {
throw err;
} else {
moduleClient.on('error', function (err) {
throw err;
});
// connect to the Edge instance
moduleClient.open(function (err) {
if (err) {
throw err;
} else {
console.log('IoT Hub module client initialized');
const simulatedTemperatureClientConnectionString = process.env.simulatedTemperatureClientConnectionString;
if (simulatedTemperatureClientConnectionString) {
console.log("Device Connection string", simulatedTemperatureClientConnectionString);
simulatedTemperatureClient = DeviceClient.fromConnectionString(simulatedTemperatureClientConnectionString, Transport);
}
else {
console.log("Please configure the device connection string in environment variables");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment