azure-iothub package

Classes

Client

The IoT Hub service client is used to communicate with devices through an Azure IoT hub. It lets the SDK user:

  • send cloud-to-device (also known as commands) to devices: commands are queued on IoT Hub and delivered asynchronously only when the device is connected. Only 50 commands can be queued per device.
  • invoke direct methods on devices (which will work only if the device is currently connected: it's a synchronous way of communicating with the device)
  • listen for feedback messages sent by devices for previous commands.
  • listen for file upload notifications from devices.

Users should create new Client instances by calling one of the factory methods, fromConnectionString or fromSharedAccessSignature, to create an IoT Hub service Client.

Device

Creates a representation of a device for use with the device identity registry APIs.

This class is deprecated because the device identity registry can work directly with JSON objects containing a partial description of the device, not necessarily the full object. On top of that initially this class was shipped with a typo on the symmetricKey property name (it was pascal-cased instead of camel-cased). The SDK is keeping this class around in order not to break existing code but this will be removed in a future major version update and customers should instead use plain JSON objects.

JobClient

Provides methods to create, update, monitor and cancel long-running jobs on an IoT Hub instance, as well as query existing jobs. The Jobs API in Azure IoT Hub allows to schedule direct method calls and twin updates on multiple devices.

SDK users are expected to create JobClient instances using the factory methods fromConnectionString(string) and fromSharedAccessSignature(string).

Registry

The Registry class provides access to the IoT Hub device identity service. Users of the SDK should instantiate this class with one of the factory methods: fromConnectionString or fromSharedAccessSignature.

The protocol used for device identity registry operations is HTTPS.

Amqp

Transport class used by the service client to connect to the Azure IoT hub using the AMQP protocol over a secure (TLS) socket. This class should not be used directly and instead be passed to one of the Client factory methods: fromConnectionString or fromSharedAccessSignature.

AmqpWs

Transport class used by the service client to connect to the Azure IoT hub using the AMQP protocol over secure websockets. This class should not be used directly and instead be passed to one of the Client factory methods: fromConnectionString or fromSharedAccessSignature.

DigitalTwinClient
IoTHubTokenCredentials

Creates shared access signatures based on the connection string passed to the constructor. This class is used by the protocol layer of the SDK to add authentication headers to each request.

Twin

A Device Twin is document describing the state of a device that is stored by an Azure IoT hub and is available even if the device is offline. It is built around 3 sections:

  • Tags: key/value pairs only accessible from the service side
  • Desired Properties: updated by a service and received by the device
  • Reported Properties: updated by the device and received by the service.

Note that although it is a possibility, desired and reported properties do not have to match and that the logic to sync these two collections, if necessary, is left to the user of the SDK.

For more information see Understanding Device Twins.

The recommended way to obtain a Twin for a specific device is to use the getTwin(string, HttpResponseCallback<Twin>) method.

Interfaces

ServiceReceiver
Transport
TransportConfigOptions
Authentication
Capabilities
X509Thumbprints
BulkRegistryOperationResult
DeviceDescription
DeviceRegistryOperationError
JobStatus
QueryDescription
RegistryStatistics
TransportConfig
Configuration

The Configuration object represents the configuration of a single device or it can represent a deployment which can be applied as a configuration to devices based on the targetCondition.

ConfigurationContent
ConfigurationMetrics
DeviceMethodParams

Describes the parameters that are available for use with direct methods (also called device methods)

Module

Type Aliases

TransportCtor
ConnectionState
DeviceStatus
JobCallback
BulkRegistryOperationType
JobCallback
ResponseCallback