How to use the azure-iot-device-mqtt.Http function in azure-iot-device-mqtt

To help you get started, we’ve selected a few azure-iot-device-mqtt examples, based on popular ways it is used in public projects.

github Azure / azure-iot-sdk-node / longhaultests / src / iothub_longhaul.ts View on Github external
/* tslint:disable:no-var-requires */
switch (process.env.DEVICE_PROTOCOL) {
  case 'amqp':
    protocol = require('azure-iot-device-amqp').Amqp;
  break;
  case 'amqp-ws':
    protocol = require('azure-iot-device-amqp').AmqpWs;
  break;
  case 'mqtt':
    protocol = require('azure-iot-device-mqtt').Mqtt;
  break;
  case 'mqtt-ws':
    protocol = require('azure-iot-device-mqtt').MqttWs;
  break;
  case 'http':
    protocol = require('azure-iot-device-mqtt').Http;
  break;
  default:
    debug('unknown protocol: ' + process.env.DEVICE_PROTOCOL);
    process.exit(ERROR_EXIT_CODE);
}
/* tslint:enable:no-var-requires */

const createDevice = (callback) => {
  debug('creating device: ' + deviceId);
  timeout(registry.create.bind(registry), MAX_CREATE_TIME)({ deviceId: deviceId }, (err, deviceInfo) => {
    if (err) {
      debug('error creating device: ' + deviceId + ':' + err.toString());
      callback(err);
    } else {
      debug('device created: ' + deviceId);
      const cs = HubConnectionString.parse(hubConnectionString);

azure-iot-device-mqtt

MQTT transport for Azure IoT device SDK

MIT
Latest version published 5 months ago

Package Health Score

84 / 100
Full package analysis

Similar packages