0

With the azure C sdk it's possible to add properties to the message envelope using Map_AddOrUpdate(propMap, "propKey", propText). Is there something similar? I'm using

const Protocol = require('azure-iot-device-mqtt').Mqtt;
const Client = require('azure-iot-device').Client;
const Message = require('azure-iot-device').Message;

client = Client.fromConnectionString(deviceConnectionString, Protocol);
// misc code
 return new Promise( (resolve,reject) => {
    client.sendEvent(message,(err,res) => {
      if ( err ) {
        logger.error(TAG,'Failed to send message: ', err.toString())
        reject(err)
      }
      if (res) logger.info(TAG,'Send status: ' + res.constructor.name);
      resolve(res)
    })
  })

I was unable to find anything in the client interface that allowed me to set envelope properties.

farhadf
  • 1,918
  • 3
  • 19
  • 27

1 Answers1

1

You can do: message.properties.add('yourProp', 'val'). You might find this sample useful.

kartben
  • 2,485
  • 21
  • 24