Azure IoT Hub Data Plane Node SDK
Перейти к файлу
Ethan Ann 6b89e4a48a
Merge pull request #55 from Azure/users/ethanann/onebranch-pipeline
skip flaky tests for the pipeline
2024-09-26 10:35:53 -04:00
.config added tsaoptions for onebranch migration 2024-05-14 13:15:37 -04:00
.github/workflows Create devskim.yml 2022-10-31 10:38:39 -07:00
samples (fix) use lerna so we can work well with samples 2022-11-16 13:54:44 -08:00
src Updated device class for GWV2, Updated dependencies and tests 2024-03-19 14:55:41 -04:00
test skip flaky tests 2024-09-26 10:34:13 -04:00
test_resources Renamed test_resouces path to test_resources 2023-06-12 16:09:49 -04:00
vsts Restore yaml file 2024-09-23 15:08:51 -04:00
.eslintignore (fix): integration tests add yaml and test resouces 2022-11-15 19:46:41 -08:00
.eslintrc.js (fix): integration tests add yaml and test resouces 2022-11-15 19:46:41 -08:00
.gitignore Initial build in new repo, switch to eslint 2022-10-31 08:21:25 -07:00
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md committed 2022-07-12 11:48:33 -07:00
CredScanSuppressions.json Rollback CredScan to true and added CredScanSuppressions.json 2023-06-12 15:23:33 -04:00
LICENSE LICENSE committed 2022-07-12 11:48:35 -07:00
README.md Initial build in new repo, switch to eslint 2022-10-31 08:21:25 -07:00
SECURITY.md SECURITY.md committed 2022-07-12 11:48:36 -07:00
SUPPORT.md SUPPORT.md committed 2022-07-12 11:48:37 -07:00
iothub.d.ts (Fix) Fix broken export 2022-11-17 17:12:13 -05:00
iothub.js (Fix) Fix broken export 2022-11-17 17:12:13 -05:00
lerna.json (fix) use lerna so we can work well with samples 2022-11-16 13:54:44 -08:00
package-lock.json add package-lock.json with updated registry 2024-09-23 14:49:20 -04:00
package.json Updated device class for GWV2, Updated dependencies and tests 2024-03-19 14:55:41 -04:00
tsconfig.json Initial build in new repo, switch to eslint 2022-10-31 08:21:25 -07:00

README.md

Microsoft Azure IoT service SDK for Node.js

The Azure IoT Service SDK for Node.js helps you build applications that interact with your devices and manage their identities in your IoT hub.

npm version

Prerequisites

You need to install the Node.js JavaScript runtime environment to run the Azure IoT JavaScript client SDK on your platform. To check if Node.js supports your platform (OS), verify that an install package is available on the Node.js download page.

npm is a command-line package manager that is installed with Node.js is installed, and will be used to install Azure IoT node.js client side SDK.

Installation

npm install azure-iothub to get the latest version.

Features

  • Create/remove/update/list device identities in your IoT hub
  • Send messages to your devices and get feedback when they're delivered
  • Work with the Azure IoT Hub Device Twins
  • Invoke Cloud to Device Direct Methods on a device

How to use the Azure IoT service SDK for Node.js

Once you have installed the package as indicated above, you can start using the features of the Service SDK in your code. Below is a code snippet showing how to add a new device in the Azure IoT Hub device registry:

Note that for this sample to work, you will need to setup your IoT hub and retrieve credentials for the service app. Utilize the '[IoT Connection String]', in quotes, on the command line invoking the sample.

var iothub = require('azure-iothub');

var connectionString = '[IoT Connection String]';

var registry = iothub.Registry.fromConnectionString(connectionString);

// Create a new device
var device = {
deviceId: 'sample-device-' + Date.now()
};

registry.create(device, function(err, deviceInfo, res) {
    if (err) console.log(op + ' error: ' + err.toString());
    if (res) console.log(op + ' status: ' + res.statusCode + ' ' + res.statusMessage);
    if (deviceInfo) console.log(op + ' device info: ' + JSON.stringify(deviceInfo));
});

Check out the samples for details on the various features of the Service SDK

Read more

Directory structure

Service SDK subfolders:

/devdoc

Development requirements documentation

/src

Code for the library

/samples

Set of simple samples showing how to use the features of the Service SDK

/test

Test files