UNPKG

mqtt

Version:

A library for the MQTT protocol

22 lines (17 loc) 498 B
'use strict' var net = require('net') var debug = require('debug')('mqttjs:tcp') /* variables port and host can be removed since you have all required information in opts object */ function streamBuilder (client, opts) { var port, host opts.port = opts.port || 1883 opts.hostname = opts.hostname || opts.host || 'localhost' port = opts.port host = opts.hostname debug('port %d and host %s', port, host) return net.createConnection(port, host) } module.exports = streamBuilder