Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ const createServer = (aedes, options = {}) => {
stream._socket = conn._socket
bindConnection(aedes, options, stream, req)
})
} else if (options.quic) {
const { createQuicSocket } = require('net')

server = createQuicSocket({
endpoint: { port: options.quic.port || 8885 }, // default port 8885 if not mentioned in options
server: {
key: options.quic.key,
cert: options.quic.cert,
alpn: options.quic.alpn || 'mqtt'
}
})
Comment on lines +73 to +80
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i look at the Node15 API doc, there are a lot more options available, why did you ignore them ?


server.on('session', (session) => {
session.on('stream', (stream) => {
stream.socket = session.socket
bindConnection(aedes, options, stream)
})
})
} else {
server = net.createServer((conn) => {
bindConnection(aedes, options, conn)
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ServerFactoryOptions {
http2?: Http2ServerOptions;
tls?: TlsOptions;
tcp?: { allowHalfOpen?: boolean; pauseOnConnect?: boolean };
quic?:{ port?: number; key: ArrayBuffer; cert: ArrayBuffer; alpn: string};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure, only ArrayBuffer is allowed for key and cert ?

serverFactory?: ServerFactory;
protocolDecoder?: ProtocolDecoder;
extractSocketDetails?: ExtractSocketDetails;
Expand Down