How to use the azure-iot-device-amqp.AmqpWs function in azure-iot-device-amqp

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / longhaultests / src / iothub_longhaul.ts View on Github external
const ERROR_EXIT_CODE = -1;
const OK_EXIT_CODE = 0;

const hubConnectionString = process.env.IOTHUB_CONNECTION_STRING;
const registry = Registry.fromConnectionString(hubConnectionString);

const deviceId = 'node-longhaul-sak-' + uuid.v4();
let protocol;

/* 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 */
github Azure / azure-iot-sdk-node / edge-e2e / wrapper / nodejs-server-server / glue / glueUtils.js View on Github external
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
'use strict';
/*jshint esversion: 6 */

var respondWithCode = require('../utils/writer').respondWithCode;
var debug = require('debug')('azure-iot-e2e:node')
var Mqtt = require('azure-iot-device-mqtt').Mqtt;
var MqttWs = require('azure-iot-device-mqtt').MqttWs;
var Amqp = require('azure-iot-device-amqp').Amqp;
var AmqpWs = require('azure-iot-device-amqp').AmqpWs;
var Http = require('azure-iot-device-http').Http;

/**
 * return failure to the caller, passing the appropriate information back.
 *
 * @param {function} reject reject function from Promise
 * @param {Error} err error to return
 * @param {string} functionName name of function with failure
 */
var returnFailure = function(reject, err, functionName) {
  var errorText = '';
  if (functionName) {
    errorText = 'failure from ' + functionName + ': ';
  }
  if (err.responseBody) {
    errorText += err.responseBody;
github Azure / azure-iot-sdk-node / device / node-red / azureiothub / azureiothub.js View on Github external
function AzureIoTHubNode(config) {
        // Store node for further use
        var node = this;
        var nodeConfig = config;

        var Client = require('azure-iot-device').Client;

        var Protocols = {
            amqp: require('azure-iot-device-amqp').Amqp,
            mqtt: require('azure-iot-device-mqtt').Mqtt,
            http: require('azure-iot-device-http').Http,
            amqpWs: require('azure-iot-device-amqp').AmqpWs
        };

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

        var client = null;
        var clientConnectionString = "";
        var clientProtocol = "";

        var statusEnum = {
            disconnected: { color: "red", text: "Disconnected" },
            connected: { color: "green", text: "Connected" },
            sent: { color: "blue", text: "Sent message" },
            received: { color: "yellow", text: "Received" },
            error: { color: "grey", text: "Error" }
        };
github Azure / iothub-diagnostics / iothubtests / index.js View on Github external
function amqpWsTest(deviceConnectionString, done) {
  runTest(deviceConnectionString, require('azure-iot-device-amqp').AmqpWs, 'AMQP/WS', done);
}
github Azure / iothub-explorer / iothub-explorer-simulate-device.js View on Github external
if(!program.deviceConnectionString && !program.args[0]) {
  inputError('You must specify either a device connection string (--device-connection-string) or the IoT Hub connection string and a device id as first argument');
}

if (!program.send && !program.receive && !program.uploadFile) {
  inputError('Nothing to do: please use --send, --receive or --uploadFile');
}

var settleMethod = program.settle || 'complete';

var protocolArg = program.protocol || 'amqp';
var Protocol;
switch(protocolArg) {
  case 'amqp-ws':
    Protocol = require('azure-iot-device-amqp').AmqpWs;
    break;
  case 'http':
    Protocol = require('azure-iot-device-http').Http;
    break;
  case 'mqtt':
    Protocol = require('azure-iot-device-mqtt').Mqtt;
    if (settleMethod !== 'complete') {
      inputError('Cannot ' + settleMethod + ' messages with MQTT: messages are automatically completed.');
    }
    break;
  case 'mqtt-ws':
    Protocol = require('azure-iot-device-mqtt').MqttWs;
    if (settleMethod !== 'complete') {
      inputError('Cannot ' + settleMethod + ' messages with MQTT: messages are automatically completed.');
    }
    break;

azure-iot-device-amqp

AMQP transport for Azure IoT device SDK

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Similar packages