From 01236ad8fb5c7df18a0a68c52db62e24ebc0ae24 Mon Sep 17 00:00:00 2001 From: Captain Nick Lucifer* Date: Sun, 12 Mar 2023 12:24:20 +0545 Subject: [PATCH] . --- .gitignore | 14 ++++++++++++++ index.html | 32 ++++++++++++++++++++++++++++++++ index.js | 24 ++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 index.html create mode 100644 index.js diff --git a/.gitignore b/.gitignore index ceaea36..864af9c 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,17 @@ dist .yarn/install-state.gz .pnp.* + +# Keys +*.crt +*.cer +*.pem +*.pfx +*.key +*.pub +*.p7s +*.p7b +*.p8 +*.p12 +*pub* +*sec* diff --git a/index.html b/index.html new file mode 100644 index 0000000..4bb40e3 --- /dev/null +++ b/index.html @@ -0,0 +1,32 @@ + + + + + Testing + + + + + + + + + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..9d37aa6 --- /dev/null +++ b/index.js @@ -0,0 +1,24 @@ +var fs = require('fs'); +var mqttServer = require('mqtt-server'); + +// TODO: impl. custom/own ports/etc.. +var servers = mqttServer({ + mqtt: 'tcp://localhost:1883', + mqtts: 'ssl://localhost:8883', + mqttws: 'ws://localhost:1884', + mqtwss: 'wss://localhost:8884' +}, { + ssl: { + key: fs.readFileSync('./server.key'), // sec.pk-gen script TODO. + cert: fs.readFileSync('./server.crt') + }, + emitEvents: true // default +}, function(client) { + client.connack({ + returnCode: 0 + }); +}); + +servers.listen(function() { + console.log('listening!'); +});