moscajs / aedes-server-factory Goto Github PK
View Code? Open in Web Editor NEWAedes server factory. Supports tcp, tls, http, https, http2, ws, wss and proxy decoders
License: MIT License
Aedes server factory. Supports tcp, tls, http, https, http2, ws, wss and proxy decoders
License: MIT License
I want to create an authentication flow, that's similar to the IoT core,
like emqx,i neet to listen 4 ports use one server(tcp :1883,tls:8883,ws:8083,wss:8084)
I have checked the README but all examples are use one port
how can i do?
thanks
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.
System Information
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>;
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);
});
according to https://github.com/moscajs/aedes/releases/tag/v0.48.0 there is a breaking change in TS
in fact, with latest version of aedes I cannot use tsc without errors with aedes-server-factory
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))
Lines 60 to 67 in b7f3c44
So, I've some doubts and confusion about using this package. I'm not sure what it is used for.
My Questions
Why should I use it?
What are the benefits of using it?
can I use it with TLS(MQTTS).? As you can see that TLS & HTTPS is still in progress.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.