tcp.js 410 B

12345678910111213141516171819
  1. 'use strict'
  2. var net = require('net')
  3. /*
  4. variables port and host can be removed since
  5. you have all required information in opts object
  6. */
  7. function buildBuilder (client, opts) {
  8. var port, host
  9. opts.port = opts.port || 1883
  10. opts.hostname = opts.hostname || opts.host || 'localhost'
  11. port = opts.port
  12. host = opts.hostname
  13. return net.createConnection(port, host)
  14. }
  15. module.exports = buildBuilder