简体   繁体   English

Azure IOT 集线器:发送遥测数据“无效传输配置”的参考错误

[英]Azure IOT Hub: ReferenceError sending Telemetry Data 'Invalid transport configuration'

I'm working on the exercise ( https://docs.microsoft.com/en-us/learn/modules/remotely-monitor-devices-with-azure-iot-hub/4-exercise-write-code-device-telemetry?pivots=vscode-node ).我正在练习( https://docs.microsoft.com/en-us/learn/modules/remotely-monitor-devices-with-azure-iot-hub/4-exercise-write-code-device-遥测?pivots=vscode-node )。 As I test my code to send telemetry, I'm getting the following error.当我测试我的代码以发送遥测数据时,我收到以下错误。

\node_modules\azure-iot-mqtt-base\dist\mqtt_base.js:356
                    throw new ReferenceError('Invalid transport configuration');

Upon reviewing the code, I noticed a warning, while installing azure-iot-device-mqtt@1.15.0 library.查看代码后,我在安装 azure-iot-device-mqtt@1.15.0 库时注意到了一个警告。

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

IoT devices require a central hub, in our case the Azure IoT Hub to upload their data to and to retrieve new configurations updates from.物联网设备需要一个中央集线器,在我们的例子中是 Azure 物联网集线器,以将其数据上传到并从中检索新的配置更新。 IoT devices can choose between different transports for their connecting to IoT Hub as follows -物联网设备可以选择不同的传输方式连接到物联网中心,如下所示 -

  • MQTT, MQTT over WebSockets MQTT,基于 WebSocket 的 MQTT
  • AMQP, AMQP over WebSockets AMQP,基于 WebSocket 的 AMQP
  • HTTPS HTTPS

Authentication is done using a symmetric key or X.509 certificates which can be either self-signed or signed by a CA.身份验证使用对称密钥或 X.509 证书完成,这些证书可以是自签名的或由 CA 签名的。 And IoT devices can send messages with a size of up to 256 KB.物联网设备可以发送最大 256 KB 的消息。 The message format can be text or binary.消息格式可以是文本或二进制。

I checked them module you mentioned in your question but didn't found any exercise or workshop, so I'm not sure where you are getting the error.我检查了你在问题中提到的模块,但没有找到任何练习或研讨会,所以我不确定你在哪里得到错误。 I would suggest to read this Azure IoT Hub: Connecting a Qt Application with Azure document for more information.我建议阅读此Azure IoT Hub:Connecting a Qt Application with Azure文档以获取更多信息。

Try the Send telemetry from an IoT Plug and Play device to Azure IoT Hub exercise and Azure IoT Hub via MQTT Connection example.尝试通过 MQTT 连接示例从 IoT 即插即用设备向 Azure IoT Hub 练习和 Azure IoT Hub 发送遥测数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM