Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

azure-iot-device-http

Package Overview
Dependencies
Maintainers
7
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-iot-device-http

HTTP transport for Azure IoT device SDK

latest
Source
npmnpm
Version
1.14.4
Version published
Weekly downloads
1.1K
3.08%
Maintainers
7
Weekly downloads
 
Created
Source

#azure-iot-device-http Communicate with Azure IoT Hub from any device over HTTP 1.1.

npm version

Install

npm install -g azure-iot-device-http@latest to get the latest (pre-release) version.

Getting Started

Create a device client:

var clientFromConnectionString = require('azure-iot-device-http').clientFromConnectionString;
var Message = require('azure-iot-device').Message;

var connectionString = '[IoT Hub device connection string]';

var client = clientFromConnectionString(connectionString);

Create a callback that sends a message and receives messages. When it receives a message it sends an acknowledgement receipt to the server:

var connectCallback = function (err) {
  if (err) {
    console.error('Could not connect: ' + err);
  } else {
    console.log('Client connected');
    var message = new Message('some data from my device');
    client.sendEvent(message, function (err) {
      if (err) console.log(err.toString());
    });

    client.on('message', function (msg) { 
      console.log(msg); 
      client.complete(msg, function () {
        console.log('completed');
      });
    }); 
  }
};

Open the connection and invoke the callback:

client.open(connectCallback);

FAQs

Package last updated on 30 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts