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

run aedes on websocket must use websocket-stream? #97

Closed
arden opened this issue Mar 30, 2017 · 6 comments
Closed

run aedes on websocket must use websocket-stream? #97

arden opened this issue Mar 30, 2017 · 6 comments

Comments

@arden
Copy link

arden commented Mar 30, 2017

run aedes on websocket must use websocket-stream?
now, websocket-stream is use ws 1.0, and ws is 2.0 released now.

@GavinDmello
Copy link
Collaborator

@arden ws 2.0 has quite a few breaking changes. You can try making websocket stream work with it and make a PR there if issues.

@mcollina
Copy link
Collaborator

ws 2.0 runs only on node >= 4.5, not 4.0.

@GavinDmello there is already some work done max-mapper/websocket-stream#106

@GavinDmello
Copy link
Collaborator

@mcollina Nice work 👍

@nguyenthenguyen
Copy link
Contributor

@mcollina I am really enjoying your work with aedes!
How do we can run aedes with both websocket and websocket ssl?

var wsPort = 2883;
var wsSslPort = 8899;
var ws = require('websocket-stream');
// WsSsl server
var wsSslServer = require('https').createServer({
	key: fs.readFileSync("./ssl/key.key"),
	cert: fs.readFileSync("./ssl/key.cer"),
	requestCert: true, // client send their certificate
	rejectUnauthorized: true,
	ca: [ fs.readFileSync("./ssl/key.cer") ]
});
ws.createServer({
  server: wsSslServer
}, aedes.handle);
wsSslServer.listen(wsSslPort, "0.0.0.0", function () {
  logger.info('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 () {
  logger.info('MQTT websocket server listening on port', wsPort)
});

This conflict port error

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:2883
    at Object.exports._errnoException (util.js:1029:11)
    at exports._exceptionWithHostPort (util.js:1052:20)
    at Server._listen2 (net.js:1264:14)
    at listen (net.js:1300:10)
    at doListening (net.js:1399:7)
    at _combinedTickCallback (internal/process/next_tick.js:83:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3

@cordovapolymer
Copy link
Contributor

@nguyenthenguyen try changing wsPort, it's already in use by some service, maybe another instance of aedes

@nguyenthenguyen
Copy link
Contributor

@cordovapolymer Yeb! wsPort it's already in use by another service. Thanks 👯

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

No branches or pull requests

5 participants