来自物联网中心的消息数据未到达Web应用程序 [英] Message data from iot hub not arriving at web app
问题描述
你好,
我成功尝试了此示例:
https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/iot-hub-live-data-visualization-in-web-apps.md
它工作正常,我可以在Web App控制台中看到消息.我用raspberry-pi-web-simulator进行了测试.
现在,我想使用现有的物联网中心来实现此解决方案.物联网中心已经具有为消息路由定义的路由和StreamAnalytics的使用者组.现在我有一个问题,就是什么都没有到达我的我们的应用程序.我不知道为什么会这样.
在中心中设置了消费者组,并在Web应用程序中设置了连接字符串.我要使用的集线器中的物联网设备具有不同的消息正文,但我想那应该不是问题.
有想法或类似经验的人吗?
干杯
尼尔斯
你好,
您的设备发送的消息应采用与树莓派设备相同的结构:
https://github.com/Azure -Samples/iot-hub-node-raspberrypi-client-app/blob/master/index.js
cb(JSON.stringify({ messageId:messageId, deviceId:this.deviceId, 温度:数据.温度, 湿度:数据湿度 }),data.temperature> this.temperatureAlert);还应包含属性'temperatureAlert'
var message =新消息(内容); message.properties.add('temperatureAlert',temperatureAlert?'true':'false');这是使用来确认是否正在IoTHub上接收消息. Visual Studio代码扩展&Azure IoT工具包
Hello ,
The messages sent by your device should follow the same structure as the raspberry pi device:
https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app/blob/master/index.js
https://github.com/Azure-Samples/iot-hub-node-raspberrypi-client-app/blob/master/messageProcessor.js
cb(JSON.stringify({ messageId: messageId, deviceId: this.deviceId, temperature: data.temperature, humidity: data.humidity }), data.temperature > this.temperatureAlert);It should also include the property 'temperatureAlert'
var message = new Message(content); message.properties.add('temperatureAlert', temperatureAlert ? 'true' : 'false');That is the only way you can visualize data using this sample without any modifications.
PS: You should also confirm if you are receiving messages on IoTHub using Visual Studio Code Extension Azure IoT Toolkit
==========================================================
If this answer was helpful, click "Mark as Answer" or Up-Vote. To provide additional feedback on your forum experience, click here
这篇关于来自物联网中心的消息数据未到达Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!