How to use the mqtt-connection.parseStream function in mqtt-connection

To help you get started, we’ve selected a few mqtt-connection 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 mcollina / aedes / test / helper.js View on Github external
'use strict'

var mqtt = require('mqtt-connection')
var through = require('through2')
var aedes = require('../')
var duplexify = require('duplexify')
var parseStream = mqtt.parseStream
var generateStream = mqtt.generateStream
var clients = 0

function setup (broker, autoClose) {
  var inStream = generateStream()
  var outStream = parseStream()
  var conn = duplexify(outStream, inStream)

  broker = broker || aedes()

  broker.handle(conn)

  if (autoClose === undefined || autoClose) {
    setTimeout(function () {
      broker.close()
    }, autoClose || 200)
github mcollina / aedes / test / aedes.js View on Github external
var test            = require('tape').test
  , mqtt            = require('mqtt-connection')
  , parseStream     = mqtt.parseStream
  , generateStream  = mqtt.generateStream
  , through         = require('through2')
  , reduplexer      = require('reduplexer')
  , aedes           = require('../')
  , clients         = 0

function setup(broker) {
  var inStream  = generateStream()
    , outStream = parseStream()
    , conn      = reduplexer(outStream, inStream)

  broker = broker || aedes()

  broker.handle(conn)

  conn.destroy = function() {

mqtt-connection

Stream-based Connection object for MQTT, extracted from MQTT.js

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis