How to use the mqtt-packet.writeToStream function in mqtt-packet

To help you get started, we’ve selected a few mqtt-packet 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 noahziheng / freeiot / firmware / nodejs / node_modules / mqtt / lib / client.js View on Github external
function sendPacket (client, packet, cb) {
  client.emit('packetsend', packet)

  var result = mqttPacket.writeToStream(packet, client.stream)

  if (!result && cb) {
    client.stream.once('drain', cb)
  } else if (cb) {
    cb()
  }
}
github mqttjs / MQTT.js / lib / client.js View on Github external
function sendPacket (client, packet, cb) {
  client.emit('packetsend', packet)

  var result = mqttPacket.writeToStream(packet, client.stream, client.options)

  if (!result && cb) {
    client.stream.once('drain', cb)
  } else if (cb) {
    cb()
  }
}
github mqttjs / mqtt-connection / lib / writeToStream.js View on Github external
function write (chunk, enc, cb) {
    if (writeToStream(chunk, output, that.opts)) {
      cb()
    } else {
      output.once('drain', cb)
    }
  }

mqtt-packet

Parse and generate MQTT packets like a breeze

MIT
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis