-
-
Save ThomasPe/78bd8bf7c15b970dd7d5a7087409ad7c to your computer and use it in GitHub Desktop.
IdentityTranslationModule message pipe
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
// Act on input messages to the module. | |
moduleClient.on('inputMessage', function (inputName, msg) { | |
console.log("new message received", msg); | |
if (simulatedTemperatureClient) { | |
// Identity Translation configured, wrap message fro IoT device | |
const message = msg.getBytes().toString('utf8'); | |
const sensorMsg = new Message(message); | |
simulatedTemperatureClient.sendEvent(sensorMsg); | |
} else { | |
// No Identity Translation configured, send message through module | |
pipeMessage(moduleClient, inputName, msg); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment