Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] is still active this repo? #7

Open
thej4ck opened this issue Mar 27, 2020 · 1 comment
Open

[question] is still active this repo? #7

thej4ck opened this issue Mar 27, 2020 · 1 comment
Labels

Comments

@thej4ck
Copy link

thej4ck commented Mar 27, 2020

i've installed it but i cannot get any logs.

var wsPort = 1883;
var wsSslPort = 1885;

var fs = require('fs');
var aedes = require('aedes')();
var logging = require('aedes-logging');
var ws = require('websocket-stream');
// WsSsl server
var wsSslServer = require('https').createServer({
	key: fs.readFileSync("./scao.key"),
	cert: fs.readFileSync("./scao.crt"),
	requestCert: false // client send their certificate
	//rejectUnauthorized: true,
	//ca: [ fs.readFileSync("./scao.crt") ]
});
ws.createServer({
  server: wsSslServer
}, aedes.handle);
wsSslServer.listen(wsSslPort, "0.0.0.0", function () {
  console.log('MQTT websocket tls server listening on port', wsSslPort)
});


// Ws server
var wsServer = require('http').createServer();
ws.createServer({
  server: wsServer
}, aedes.handle);
wsServer.listen(wsPort, "0.0.0.0", function () {
    console.log('MQTT websocket server listening on port', wsPort)
});

var servers = [ wsServer, wsSslServer ];
var instance	= aedes;

logging({
	instance: instance,
	servers: servers
  })
*/




  'use strict'

var fs = require('fs')
var path = require('path')
var http = require('http')
var https = require('https')
var websocket = require('websocket-stream')
var net = require('net')
var tls = require('tls')
var aedes = require('aedes')
var logging = require('aedes-logging')
var instance = aedes()

var servers = [
  startHttp(),
  startHttps(),
  startNet(),
  startTLS()
]

logging({
  instance: instance,
  servers: servers
})

function startHttp () {
  var server = http.createServer()
  websocket.createServer({
    server: server
  }, instance.handle)
  server.listen(8880)
  return server
}

function startHttps () {
  var server = https.createServer({
    key: fs.readFileSync(path.join(__dirname, 'cert', 'scao.key')),
    cert: fs.readFileSync(path.join(__dirname, 'cert', 'scao.crt'))
  })
  websocket.createServer({
    server: server
  }, instance.handle)
  server.listen(8881)
  return server
}

function startNet () {
  return net.createServer(instance.handle).listen(8882)
}

function startTLS () {
  return tls.createServer({
    key: fs.readFileSync(path.join(__dirname, 'cert', 'scao.key')),
    cert: fs.readFileSync(path.join(__dirname, 'cert', 'scao.crt'))
  }, instance.handle).listen(8883)
}
@mcollina
Copy link
Collaborator

This module likely needs some work, would you like to send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants