不使用 Azure IoT 中心 SDK 进行开发Develop without using an Azure IoT Hub SDK

本主题为希望不使用 Azure IoT SDK 开发设备或后端应用的开发人员提供有用的信息和链接。This topic provides helpful information and links for developers who want to develop device or back-end apps without using the Azure IoT SDKs.

Microsoft 强烈建议使用 Azure IoT SDK。Microsoft strongly advises using an Azure IoT SDK. Azure IoT 设备和服务 SDK 在许多流行平台上发布。The Azure IoT device and service SDKs are published on many popular platforms. SDK 提供了一个方便层,可以处理底层通信协议的许多复杂问题,包括设备连接和重新连接,以及重试策略。The SDKs provide a convenience layer that handles much of the complexity of the underlying communication protocol, including device connection and reconnection, and retry policy. SDK 会定期更新,以提供 IoT 中心公开的最新功能以及安全更新。The SDKs are regularly updated to provide the latest features exposed by IoT Hub as well as security updates. 使用 SDK 可以帮助你减少开发时间和用于代码维护的时间。Using the SDKs can help you reduce development time and time devoted to code maintenance. 若要了解有关 Azure IoT SDK 的更多信息,请参阅 Azure IoT设备和服务 SDKTo learn more about the Azure IoT SDKs, see Azure IoT Device and Service SDKs. 有关使用 Azure IoT SDK 的优势的详细信息,请参阅使用 Azure IoT SDK 的优势以及如果不使用需要避免的陷阱博客文章。For more detail about the advantages of using an Azure IoT SDK, see the Benefits of using the Azure IoT SDKs and pitfalls to avoid if you don’t blog post.

尽管 IoT 中心支持 AMQP、AMQP over WebSockets、HTTPS、MQTT 和 MQTT over WebSockets 来与设备进行通信,但如果你的设备支持 MQTT,我们建议你使用它。Although IoT Hub supports AMQP, AMQP over WebSockets, HTTPS, MQTT, and MQTT over WebSockets for communication with devices, we recommend using MQTT if your device supports it.

开发必备组件Development prerequisites

在开始开发之前,你应该对 IoT 中心和想要设备或后端应用实现的功能有透彻的了解。Before you begin development, you should have a thorough knowledge of IoT Hub and the features you want your device or back-end app to implement. 以下是你应该熟悉的主题的简短列表:Here's a very abbreviated list of topics that you should be familiar with:

  • 确保你了解 IoT 中心公开的终结点以及每个终结点上支持的协议。Make sure you understand the endpoints exposed by IoT Hub and the protocols supported on each endpoint. 若要了解详细信息,请参阅 IoT 中心终结点To learn more, see IoT Hub endpoints.

  • 在设备应用涉及协议选择的地方,我们强烈建议你使用 MQTT。Where a choice of protocol is involved for device apps, we strongly recommend that you use MQTT. 但是,在选择协议之前,请确保你了解每个协议所强加的限制。Before choosing a protocol, though, make sure you understand the limitations imposed by each. 若要了解详细信息,请参阅选择通信协议To learn more, see Choose a communication protocol.

  • 若要了解使用 IoT 中心的身份验证,请参阅控制对 IoT 中心的访问权限To understand authentication with IoT Hub, see Control access to IoT Hub.

重要

使用 X.509 证书颁发机构 (CA) 身份验证的设备的以下功能尚未正式发布,必须启用预览模式The following functionality for devices that use X.509 certificate authority (CA) authentication is not yet generally available, and preview mode must be enabled:

  • HTTPS、基于 WebSocket 的 MQTT 和基于 WebSocket 的 AMQP 协议。HTTPS, MQTT over WebSockets, and AMQP over WebSockets protocols.
  • 文件上传(所有协议)。File uploads (all protocols).

它在使用 X.509 指纹身份验证的设备上已正式发布。It is generally available on devices that use X.509 thumbprint authentication. 若要了解有关使用 IoT 中心进行 x.509 身份验证的详细信息,请参阅支持的 x.509 证书To learn more about X.509 authentication with IoT Hub, see Supported X.509 certificates.

有关不同协议的帮助Help on different protocols

有关在不使用 Azure IoT SDK 的情况下使用以下协议的帮助:For help using the following protocols without an Azure IoT SDK:

  • AMQP 上的设备或后端应用,请参阅 AMQP 支持Device or back-end apps on AMQP , see AMQP support.

  • MQTT 上的设备应用,请参阅 MQTT 支持Device apps on MQTT , see MQTT support. 本主题中大部分都直接使用 MQTT 协议。Most of this topic treats using the MQTT protocol directly. 还包含有关使用 IoT MQTT 示例存储库的信息。It also contains information about using the IoT MQTT Sample repository. 该存储库包含使用 Eclipse Mosquitto 库将消息发送到 IoT 中心的 C 示例。This repository contains C samples that use the Eclipse Mosquitto library to send messages to IoT Hub.

  • HTTPS 上的设备或后端应用,请查阅 Azure IoT 中心 REST APIDevice or back-end apps on HTTPS , consult the Azure IoT Hub REST APIs. 请注意,如开发必备组件中所述,你不能将 X.509 证书颁发机构 (CA) 身份验证和 HTTPS 一起使用。Be aware, as noted in Development prerequisites, that you can't use X.509 certificate authority (CA) authentication with HTTPS.

对于设备,我们强烈建议使用 MQTT (如果设备支持)。For devices, we strongly recommend using MQTT if your device supports it.

后续步骤Next steps