A Node.js SDK for connecting devices to Microsoft Azure IoT services
OTHER License
Bot releases are hidden (Show)
Published by pierreca almost 7 years ago
A large proportion of issues reported with the device SDK are connectivity issues. with this in mind we set out a few months ago to rewrite the transports layers to be more stable and introduced code that enabled better state and error management for each protocol - in this release, we were finally able to remove the over-arching client state machine that had become useless and was causing issues. We have now introduced per-operation retries on top of that.
This means that when a user calls any of the device client API (subscribe to receive C2D messages, send telemetry, etc) the client doesn't have to know what the transport should do: just ask the transport to do it and report. the transport can then bubble up either a success result or an error. It's then up to the client to ask the transport to retry or send the error back to the user.
By default, the client will retry using "an exponential backoff with jitter" strategy, for up to 4 minutes. This is done without any changes to the API surface. your code will automatically benefit from this.
It is possible for a user to disable retries alltogether, or to define a custom retry logic and feed this to the client using the Client.setRetryPolicy()
API.
For example:
var Client = require('azure-iot-device').Client;
var Amqp = require('azure-iot-device').Amqp;
var NoRetry = require('azure-iot-common').NoRetry;
var client = Client.fromConnectionString('<connectionString>', Amqp);
// Disable Retries
client.setRetryPolicy(new NoRetry());
// Custom retry policy
var myRetryPolicy = {
shouldRetry: function (err) {
// decide depending on err if you would like to retry or not - should return true or false.
},
nextRetryTimeout: function (retryCount, throttled) {
// should return an integer that is the number of milliseconds to wait before the next retry
// based on the current count of retries (retryCount)
// and if the IoT Hub is asking clients to throttle their calls (throttled, boolean)
}
}
client.setRetryPolicy(myRetryPolicy);
caveat
There are a few issues that this won't solve and that we will tackle next:
error
event - we are looking for ways to circumvent thisTwin
type to azure-iothub
exports. Thanks @nebrius !!Published by pierreca about 7 years ago
This release includes upgrades to the inner workings of the transport packages (AMQP, MQTT and HTTP) to prepare for the introduction of retries in what will be the SDK version 1.2.0
RestApiClient
) so that more code can be shared between packages.No API or behavioral changes should be apparent yet (except maybe more stable/more consistent connections)
Published by pierreca about 7 years ago
All the changes in this release are internal refactoring, as we get ready to introduce the much awaited retry logic.
Published by pierreca about 7 years ago
Fix for #76 - Fix Content-Length on UTF-8 2 bytes characters. Special thanks to @Kaaml for this!
Published by pierreca about 7 years ago
Bugs fixed
PR accepted
Improvements
Published by anthonyvercolano over 7 years ago
Published by anthonyvercolano over 7 years ago
Published by anthonyvercolano over 7 years ago
Published by pierreca over 7 years ago
Published by pierreca over 7 years ago
Published by pierreca over 7 years ago
timeoutInSeconds
parameter instead of connectTimeoutInSeconds
and responseTimeoutInSeconds
.We've switched to typescript during this release. while we expect no breaking changes and have decent end-to-end test coverage, it is not impossible that we missed something, especially as we turn from manual to automatic generation of d.ts file. please report any problem you find!
Published by pierreca over 7 years ago
Bugfixes:
Published by pierreca over 7 years ago
Published by pierreca over 7 years ago
Published by pierreca over 7 years ago
See the code sample for details
Pulled #16 and #17 to improve docs.
Added a few internal APIs to azure-iot-common
and azure-iot-amqp-base
to enable future work.
Published by anthonyvercolano over 7 years ago
Update the readme on how to run samples.
Various changes/fixes to the end to end tests.
Published by pierreca over 7 years ago
ConnectionString.createWithSharedAccessKey()
and ConnectionString.createWithX509Certificate()
APIsThanks to @jsturtevant for helping with the iothub-explorer debugging instructions!
Published by pierreca over 7 years ago
Published by pierreca almost 8 years ago
Special thanks to: @stewartadam for his contributions to the docs and good feedback in #9 that led us to 784f5dc, 7806b43 and b780708
Published by pierreca almost 8 years ago