Git Product home page Git Product logo

aedes-server-factory's People

Contributors

getlarge avatar linqfr avatar robertslando avatar tnraro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aedes-server-factory's Issues

Request client certificate behind a proxy [question]

  • aedes: 0.48.0
  • aedes-server-factory: 0.2.1
  • aedes-protocol-decoder: 2.1.0

When we start an instance of aedes with TLS object passed to createServer function, then we are able to request the client certificate info - when we work with self-signed certs and want to authenticate with them. The property is requestCert = true.
But in this case, aedes provides a secured connection and it should define ca, cert, key etc.

The question is: Is there a way to request the client certificate, without passing a TLS object to the createServer function? In this case, the proxy server behind a backend provides a server certificate.

  • send-proxy is enabled on proxy side
  • trustProxy is enabled on aedes side

[bug] Typo in type definitions

System Information

  • Aedes: 0.40.1
  • NodeJS: 12.13.1
  • OS: Ubuntu 18.04
  • Arch: x86_64

Describe the bug
There is a typo in types/index.d.ts

customWSErrorHandler:? (error: Error) => void | Promise<void>;
should be
customWSErrorHandler?: (error: Error) => void | Promise<void>;

When the port is occupied, the program hangs without throwing any errors

  • Win10
  • Node 12
  • packages lastest version
const aedes = require('aedes')();
const server = require('aedes-server-factory').createServer(aedes, {
  ws: true,
});
const port = 8888; // be used for other app

server.listen(port, function () {
  // never got here
  console.log('server started and listening on port ', port);
});

Websocket errors are not handled

Websocket is not handling 'error' event.

node:events:342
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use 127.0.0.1:8883
    at Server.setupListenHandle [as _listen2] (node:net:1306:16)
    at listenInCluster (node:net:1354:12)
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:1492:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:8)
    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:131:17)
Emitted 'error' event on WebSocketServer instance at:
    at Server.emit (node:events:365:28)
    at emitErrorNT (node:net:1333:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '127.0.0.1',
  port: 8883
}

Maybe it should be exposed through something like this before ws.on('connection',...):

ws.on('error', error=>aedes.emit('error',error))

const ws = new WebSocket.Server({ server })
ws.on('connection', (conn, req) => {
const stream = WebSocket.createWebSocketStream(conn)
// the _socket object is needed in bindConnection to retrieve info from the stream
// before passing it to aedes.handle
stream._socket = conn._socket
bindConnection(aedes, options, stream, req)
})

[feat] Move mqtt parser to server-factory

Based on this: #2 (comment)

I was also thinking about another idea, I would like to move the mqtt parser to the server factory, so the client will always receive plain mqtt, in that case I would create another function for example handleMqtt that will accept a plain mqtt stream instead (along with connection details)

@mcollina What do you think? Everytime I look into client.nextBath I think that we could do something better, do you have any suggestion?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.