azure-iot-common package

Classes

Message

The Message object is used for telemetry (device-to-cloud) and commands (cloud-to-device) asynchronous messaging between the device and the IoT Hub service. It is transport-agnostic, meaning it works the same way over AMQP, MQTT and HTTP.

ArgumentError

Error thrown when an argument is invalid.

ArgumentOutOfRangeError

Error thrown when an argument has a value that is out of the admissible range.

BadDeviceResponseError

Error thrown when a device sends a bad response to a device method call.

CloudToDeviceDetachedError

Error thrown when the c2d feature stopped working at the transport level, requiring the client to retry starting it.

DeviceAlreadyExistsError

Error thrown when the device id used for device creation already exists in the Device Identity Registry.

DeviceMaximumQueueDepthExceededError

Error thrown when the message queue for a device is full.

DeviceMessageLockLostError

Error thrown when settling a message fails because the lock token associated with the message is lost.

DeviceMethodsDetachedError

Error thrown when the device methods feature stopped working at the transport level, requiring the client to retry starting it.

DeviceNotFoundError

Error thrown when a device cannot be found in the IoT Hub instance registry.

DeviceRegistrationFailedError

Error thrown when a DPS registration operation fails

DeviceTimeoutError

Error thrown when the device doesn't process the method call in time.

FormatError

Error thrown when a string that is supposed to have a specific formatting is not formatted properly.

GatewayTimeoutError

Error thrown when the IoT Hub instance doesn't process the device method call in time.

InternalServerError

Error thrown when an internal server error occurred. You may have found a bug?

InvalidEtagError

Error thrown when the eTag specified is incorrectly formatted or out of date.

InvalidOperationError

Error thrown when an operation is attempted but is not allowed.

IotHubNotFoundError

Error thrown when the Azure IoT hub was not found.

IotHubQuotaExceededError

Error thrown the the Azure IoT hub quota has been exceeded. Quotas are reset periodically, this operation will have to wait until then. To learn more about quotas, see Azure IoT Hub quotas and throttling

IoTHubSuspendedError

Error thrown when IoT Hub has been suspended.

JobNotFoundError

Error thrown when the job with the specified identifier was not found.

MessageTooLargeError

Error thrown when the message sent is too large: the maximum size is 256Kb.

NotConnectedError

Error thrown when the device is disconnected and the operation cannot be completed.

NotImplementedError

Error thrown when a feature is not implemented yet but the placeholder is present.

OperationCancelledError

Error thrown when any operation (local or remote) is cancelled

PreconditionFailedError

Error thrown when a condition that should have been met in order to execute an operation was not.

SecurityDeviceError

Error thrown when a low level security device/driver fails.

ServiceUnavailableError

Error thrown when the service is unavailable. The operation should be retried.

ThrottlingError

Error thrown when IoT Hub is throttled due to excessive activity. To learn more about quotas, see Azure IoT Hub quotas and throttling

TimeoutError

Error thrown when a timeout occurs

TooManyDevicesError

Error thrown when the maximum number of devices on a specific hub has been reached.

TwinDetachedError

Error thrown when the twin feature stopped working at the transport level, requiring the client to retry starting it.

TwinRequestError

Generic error thrown when a twin request fails with an unknown error code.

UnauthorizedError

Error thrown when the connection parameters are wrong and the server refused the connection.

Connected

Result returned when a transport is successfully connected.

Disconnected

Result returned when a transport is successfully disconnected.

MessageAbandoned

Result returned when a message was successfully abandoned.

MessageCompleted

Result returned when a message was successfully rejected.

MessageEnqueued

Result returned when a message was successfully enqueued.

MessageRejected

Result returned when a message was successfully rejected.

SharedAccessSignatureUpdated

Result returned when a SAS token has been successfully updated.

TransportConfigured

Result returned when a transport is successfully configured.

ConnectionString

Describes the parameters that enable a device or cloud application to connect to an Azure IoT hub.

ExponentialBackOffWithJitter

Implements an Exponential Backoff with Jitter retry strategy. The function to calculate the next interval is the following (x is the xth retry): F(x) = min(Cmin+ (2^(x-1)-1) * rand(C * (1 – Jd), C*(1-Ju)), Cmax)

NoRetry

Stub policy that blocks any retry tentative. Operations are not retried.

RetryOperation

Implements the necessary logic to retry operations such as connecting, receiving C2D messages, sending telemetry, twin updates, etc.

SharedAccessSignature

Shared access signature tokens are used to authenticate the connection when using symmetric keys (as opposed to x509 certificates) to secure the connection with the Azure IoT hub.

Interfaces

AuthenticationProvider

Interface that must be implemented by objects that are used to provide credentials to the transports used by the device client to authenticate with an Azure IoT hub instance.

Receiver
RetryPolicy

Interface describing a retry policy object. Retry policies are composed of 2 things

  • An algorithm that computes the next time to retry based on the current number or retries.
  • An error filter that decides, based on the type of error received, whether a retry should happen or not.

Those 2 components hide behind 2 method calls described in this interface.

TransportConfig

Configuration structure used by transports and AuthenticationProvider objects to store and exchange credentials.

X509

Object used to store an X509 certificate and key for transports to use.

This is passed directly down to the low-level objects used by Node.js to connect the TLS socket. https://nodejs.org/api/tls.html#tls_tls_connect_options_callback

Type Aliases

BufferConvertible
ResultWithHttpResponse
Callback

Defines type describing regular callback with two results - one is the Error, the other one is the result value.

DoubleValueCallback

Defines type describing callback with two results.

ErrorCallback

Defines type describing callback with only Error result value.

HttpResponseCallback

Defines type describing callback with three results - response, raw HTTP response and an Error.

NoErrorCallback

Defines type describing callback with one non-error result value.

TripleValueCallback

Defines type describing regular callback with three results - the first one is Error, the other two are the result values.

Enums

AuthenticationType

Designate the type of authentication used by an AuthenticationProvider.

Functions

anHourFromNow()

Returns the seconds elapsed since 1 January 1970 00:00:00 UTC until one hour from now.

encodeUriComponentStrict(string)

Function Details

anHourFromNow()

Returns the seconds elapsed since 1 January 1970 00:00:00 UTC until one hour from now.

function anHourFromNow(): number

Returns

number

encodeUriComponentStrict(string)

function encodeUriComponentStrict(str: string): string

Parameters

str

string

Returns

string