locked
Microsoft Azure IoT Device SDK for Node.js - MQTT over WebSockets RRS feed

  • Question

  • Hi,

    According to the documentation, it's possible to send MQTT messages over websockets using Microsoft Azure IoT Device SDK for Node.js.

    https://azure.github.io/azure-iot-sdk-node/azure-iot-device/1.1.1/index.html

    However, I didn't find any example of how accomplish this. I want to use port 443 instead of 8883.

    Can someone enlighten me?

    Thursday, February 2, 2017 3:36 PM

Answers

  • Hi MarinaMT,

    - have a look at the MSDN Document Create a simulated device app.

    In the step 4. change the device protocol to the MqttWs, see the following code line:

    var Mqtt = require('azure-iot-device-mqtt').MqttWs;

    this constructor will initialize  the uri property of the config object to

    wss://<host>:443/$iothub/websocket

    Thanks

    Roman




    • Edited by Roman Kiss Thursday, February 2, 2017 6:30 PM
    • Marked as answer by MarinaMT Thursday, February 2, 2017 9:06 PM
    Thursday, February 2, 2017 6:28 PM

All replies

  • Hi MarinaMT,

    - have a look at the MSDN Document Create a simulated device app.

    In the step 4. change the device protocol to the MqttWs, see the following code line:

    var Mqtt = require('azure-iot-device-mqtt').MqttWs;

    this constructor will initialize  the uri property of the config object to

    wss://<host>:443/$iothub/websocket

    Thanks

    Roman




    • Edited by Roman Kiss Thursday, February 2, 2017 6:30 PM
    • Marked as answer by MarinaMT Thursday, February 2, 2017 9:06 PM
    Thursday, February 2, 2017 6:28 PM
  • Lot of thanks!
    Thursday, February 2, 2017 9:06 PM