electricimp / azureiothub Goto Github PK
View Code? Open in Web Editor NEWMicrosoft Azure IoT Hub client
License: Other
Microsoft Azure IoT Hub client
License: Other
Refer to http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/. In my opinion, "error-first" callbacks are the appropriate pattern and are worth making a major release of the class over.
retrieveTwinProperties(onRetrieved) follows this pattern with its error, reportedProps, desiredProps
signature. All of the callbacks that only take a single parameter of error
obviously do too.
However, 2 callbacks are offenders...
onUpdated(**props**, error)
instead of being onUpdated(error, props)
Its a minor code/documentation effort for the library and since the libraries are versioned it seems like something that should be considered? Thoughts?
most recent version now REST API version for IoT Hub is "2016-02-03โ
current code uses "2015-08-15-preview"
I have a use case for using a direct method that requires async communication with the device (using something like message manager). Unfortunately, the onMethod callback stipulates that the "The callback MUST return an instance of the of the AzureIoTHub.DirectMethodResponse" in order to reply.
I would like to propose that https://github.com/electricimp/AzureIoTHub/blob/master/AzureIoTHub.agent.lib.nut#L1342 be modified to respect a return value of an instanceof
promise in addition to the synchronous callback that is allowed today. The promise would need to resolve with a AzureIoTHub.DirectMethodResponse (perhaps within a timeout?) in order to send the response to IoT Hub.
The documentation still lists the previous convention (error-last) on the callbacks, please update
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.