redweb 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,105 +1,105 @@
1
- const express = require('express');
2
- const bodyParser = require('body-parser');
3
- const path = require('path');
4
- const cors = require('cors');
5
- const fs = require('fs');
6
- const HtmxRenderer = require('../htmx/HtmxRenderer'); // Import the HtmxRenderer module
7
-
8
- /**
9
- * @typedef {'json' | 'urlencoded'} RedWebEncoding
10
- */
11
-
12
- /**
13
- * RedWeb options object.
14
- * @typedef {Object} RedWebOptions
15
- * @property {number} [port=80] - The port number to bind the server.
16
- * @property {string} [bind='0.0.0.0'] - The bind address for the server.
17
- * @property {string[]} [publicPaths=['./public']] - An array of paths to serve static files from.
18
- * @property {Array<{serviceName: string, method: string, function: Function}>} [services=[]] - An array of services with their endpoints and handlers.
19
- * @property {Function} [listenCallback] - Callback function to execute once the server starts listening.
20
- * @property {RedWebEncoding} [encoding='json'] - The encoding type for the request bodies ('json' or 'urlencoded').
21
- * @property {Object} [ssl] - SSL configuration for HTTPS server.
22
- * @property {string} [ssl.key] - Path to the SSL key file.
23
- * @property {string} [ssl.cert] - Path to the SSL certificate file.
24
- * @property {import('express').Application} [server] - Whether to automatically start listening.
25
- * @property {import('cors').CorsOptions} [corsOptions] - The CORS Options.
26
- * @property {boolean} [enableHtmxRendering=false] - Enable dynamic HTMX file rendering.
27
- */
28
-
29
- const ENCODINGS = { json: 'json', urlencoded: 'urlencoded' };
30
- const HTTP_OPTIONS = {
31
- port: 80,
32
- bind: '0.0.0.0',
33
- publicPaths: ['./public'],
34
- services: [],
35
- listenCallback: undefined,
36
- encoding: ENCODINGS.json,
37
- ssl: null,
38
- server: undefined,
39
- corsOptions: undefined,
40
- enableHtmxRendering: false, // New option for HTMX rendering
41
- };
42
-
43
- /**
44
- * Base HTTP Server
45
- * @param {RedWebOptions} options - Configuration options for RedWeb.
46
- * @return {Object} Express application instance.
47
- */
48
- function BaseHttpServer(options = {}) {
49
- this.options = { ...HTTP_OPTIONS, ...options };
50
- this.app = express() || this.options.server;
51
- Object.assign(this, this.options);
52
-
53
- // Middleware to parse request bodies based on the specified encoding
54
- if (this.encoding === ENCODINGS.json) {
55
- this.app.use(bodyParser.json());
56
- } else if (this.encoding === ENCODINGS.urlencoded) {
57
- this.app.use(bodyParser.urlencoded({ extended: true }));
58
- }
59
-
60
- this.app.use(cors(this.options.corsOptions));
61
-
62
- // Enable HTMX rendering if the flag is set
63
- if (this.enableHtmxRendering) {
64
- this.app.get('*.htmx', (req, res) => {
65
- // Find the file in one of the publicPaths
66
- const filePath = this.publicPaths
67
- .map(publicPath => path.join(process.cwd(), publicPath, req.path))
68
- .find(fullPath => fs.existsSync(fullPath)); // Check if the file exists
69
-
70
- if (!filePath) {
71
- return res.status(404).send(`Error rendering HTMX file: Template file not found: ${req.path}`);
72
- }
73
-
74
- try {
75
- const renderedContent = HtmxRenderer.render(filePath);
76
- res.type('html').send(renderedContent);
77
- } catch (error) {
78
- res.status(500).send(`Error rendering HTMX file: ${error.message}`);
79
- }
80
- });
81
- }
82
-
83
-
84
- // Serve static files from public paths
85
- this.publicPaths.forEach((publicPath) =>
86
- this.app.use(express.static(path.join(process.cwd(), publicPath)))
87
- );
88
-
89
- const catchAll = this.services.find((service) => service.serviceName === '*');
90
- if (catchAll) this.services.splice(this.services.indexOf(catchAll), 1);
91
- this.services.forEach((service) =>
92
- this.app[service.method](service.serviceName, service.function)
93
- );
94
- if (catchAll) this.app[catchAll.method](catchAll.serviceName, catchAll.function);
95
-
96
- return this;
97
- }
98
-
99
-
100
- module.exports = {
101
- BaseHttpServer,
102
- ENCODINGS,
103
- HTTP_OPTIONS,
104
- METHODS: { GET: 'get', POST: 'post', PUT: 'put', DELETE: 'delete' },
105
- };
1
+ const express = require('express');
2
+ const bodyParser = require('body-parser');
3
+ const path = require('path');
4
+ const cors = require('cors');
5
+ const fs = require('fs');
6
+ const HtmxRenderer = require('../htmx/HtmxRenderer'); // Import the HtmxRenderer module
7
+
8
+ /**
9
+ * @typedef {'json' | 'urlencoded'} RedWebEncoding
10
+ */
11
+
12
+ /**
13
+ * RedWeb options object.
14
+ * @typedef {Object} RedWebOptions
15
+ * @property {number} [port=80] - The port number to bind the server.
16
+ * @property {string} [bind='0.0.0.0'] - The bind address for the server.
17
+ * @property {string[]} [publicPaths=['./public']] - An array of paths to serve static files from.
18
+ * @property {Array<{serviceName: string, method: string, function: Function}>} [services=[]] - An array of services with their endpoints and handlers.
19
+ * @property {Function} [listenCallback] - Callback function to execute once the server starts listening.
20
+ * @property {RedWebEncoding} [encoding='json'] - The encoding type for the request bodies ('json' or 'urlencoded').
21
+ * @property {Object} [ssl] - SSL configuration for HTTPS server.
22
+ * @property {string} [ssl.key] - Path to the SSL key file.
23
+ * @property {string} [ssl.cert] - Path to the SSL certificate file.
24
+ * @property {import('express').Application} [server] - Whether to automatically start listening.
25
+ * @property {import('cors').CorsOptions} [corsOptions] - The CORS Options.
26
+ * @property {boolean} [enableHtmxRendering=false] - Enable dynamic HTMX file rendering.
27
+ */
28
+
29
+ const ENCODINGS = { json: 'json', urlencoded: 'urlencoded' };
30
+ const HTTP_OPTIONS = {
31
+ port: 80,
32
+ bind: '0.0.0.0',
33
+ publicPaths: ['./public'],
34
+ services: [],
35
+ listenCallback: undefined,
36
+ encoding: ENCODINGS.json,
37
+ ssl: null,
38
+ server: undefined,
39
+ corsOptions: undefined,
40
+ enableHtmxRendering: false, // New option for HTMX rendering
41
+ };
42
+
43
+ /**
44
+ * Base HTTP Server
45
+ * @param {RedWebOptions} options - Configuration options for RedWeb.
46
+ * @return {Object} Express application instance.
47
+ */
48
+ function BaseHttpServer(options = {}) {
49
+ this.options = { ...HTTP_OPTIONS, ...options };
50
+ this.app = express() || this.options.server;
51
+ Object.assign(this, this.options);
52
+
53
+ // Middleware to parse request bodies based on the specified encoding
54
+ if (this.encoding === ENCODINGS.json) {
55
+ this.app.use(bodyParser.json());
56
+ } else if (this.encoding === ENCODINGS.urlencoded) {
57
+ this.app.use(bodyParser.urlencoded({ extended: true }));
58
+ }
59
+
60
+ this.app.use(cors(this.options.corsOptions));
61
+
62
+ // Enable HTMX rendering if the flag is set
63
+ if (this.enableHtmxRendering) {
64
+ this.app.get('*.htmx', (req, res) => {
65
+ // Find the file in one of the publicPaths
66
+ const filePath = this.publicPaths
67
+ .map(publicPath => path.join(process.cwd(), publicPath, req.path))
68
+ .find(fullPath => fs.existsSync(fullPath)); // Check if the file exists
69
+
70
+ if (!filePath) {
71
+ return res.status(404).send(`Error rendering HTMX file: Template file not found: ${req.path}`);
72
+ }
73
+
74
+ try {
75
+ const renderedContent = HtmxRenderer.render(filePath);
76
+ res.type('html').send(renderedContent);
77
+ } catch (error) {
78
+ res.status(500).send(`Error rendering HTMX file: ${error.message}`);
79
+ }
80
+ });
81
+ }
82
+
83
+
84
+ // Serve static files from public paths
85
+ this.publicPaths.forEach((publicPath) =>
86
+ this.app.use(express.static(path.join(process.cwd(), publicPath)))
87
+ );
88
+
89
+ const catchAll = this.services.find((service) => service.serviceName === '*');
90
+ if (catchAll) this.services.splice(this.services.indexOf(catchAll), 1);
91
+ this.services.forEach((service) =>
92
+ this.app[service.method](service.serviceName, service.function)
93
+ );
94
+ if (catchAll) this.app[catchAll.method](catchAll.serviceName, catchAll.function);
95
+
96
+ return this;
97
+ }
98
+
99
+
100
+ module.exports = {
101
+ BaseHttpServer,
102
+ ENCODINGS,
103
+ HTTP_OPTIONS,
104
+ METHODS: { GET: 'get', POST: 'post', PUT: 'put', DELETE: 'delete' },
105
+ };
@@ -1,14 +1,14 @@
1
- const { BaseHttpServer } = require('./BaseHttpServer');
2
-
3
- /**
4
- * HTTP Server
5
- * @param {RedWebOptions} options - Configuration options for RedWeb.
6
- * @return {Object} Express application instance.
7
- */
8
- function HttpServer(options = {}) {
9
- BaseHttpServer.call(this, options);
10
- this.server = this.app.listen(this.port, this.listenCallback ? this.listenCallback : () => console.log(`RedWeb HttpServer listening on port ${this.port}`));
11
- return this;
12
- }
13
-
14
- module.exports = HttpServer;
1
+ const { BaseHttpServer } = require('./BaseHttpServer');
2
+
3
+ /**
4
+ * HTTP Server
5
+ * @param {RedWebOptions} options - Configuration options for RedWeb.
6
+ * @return {Object} Express application instance.
7
+ */
8
+ function HttpServer(options = {}) {
9
+ BaseHttpServer.call(this, options);
10
+ this.server = this.app.listen(this.port, this.listenCallback ? this.listenCallback : () => console.log(`RedWeb HttpServer listening on port ${this.port}`));
11
+ return this;
12
+ }
13
+
14
+ module.exports = HttpServer;
@@ -1,17 +1,17 @@
1
- const https = require('https');
2
- const { BaseHttpServer } = require('./BaseHttpServer');
3
- const loadSslConfig = require('../sslConfig');
4
-
5
- /**
6
- * HTTPS Server
7
- * @param {RedWebOptions} options - Configuration options for RedWeb.
8
- * @return {Object} Express application instance.
9
- */
10
- function HttpsServer(options = {}) {
11
- BaseHttpServer.call(this, options);
12
- const sslOptions = loadSslConfig(this.ssl);
13
- https.createServer(sslOptions, this.app).listen(this.port, this.listenCallback ? this.listenCallback : () => console.log(`RedWeb HttpsServer listening on port ${this.port}`));
14
- return this;
15
- }
16
-
17
- module.exports = HttpsServer;
1
+ const https = require('https');
2
+ const { BaseHttpServer } = require('./BaseHttpServer');
3
+ const loadSslConfig = require('../sslConfig');
4
+
5
+ /**
6
+ * HTTPS Server
7
+ * @param {RedWebOptions} options - Configuration options for RedWeb.
8
+ * @return {Object} Express application instance.
9
+ */
10
+ function HttpsServer(options = {}) {
11
+ BaseHttpServer.call(this, options);
12
+ const sslOptions = loadSslConfig(this.ssl);
13
+ https.createServer(sslOptions, this.app).listen(this.port, this.listenCallback ? this.listenCallback : () => console.log(`RedWeb HttpsServer listening on port ${this.port}`));
14
+ return this;
15
+ }
16
+
17
+ module.exports = HttpsServer;
package/src/http/index.js CHANGED
@@ -1,2 +1,2 @@
1
- const { METHODS } = require('./BaseHttpServer');
1
+ const { METHODS } = require('./BaseHttpServer');
2
2
  module.exports = { HttpServer: require('./HttpServer'), HttpsServer: require('./HttpsServer'), METHODS}
package/src/sslConfig.js CHANGED
@@ -1,20 +1,20 @@
1
- const fs = require('fs');
2
-
3
- /**
4
- * Load SSL configuration
5
- * @param {Object} sslOptions - The SSL options object containing the paths to key and cert files.
6
- * @param {string} sslOptions.key - Path to the SSL key file.
7
- * @param {string} sslOptions.cert - Path to the SSL certificate file.
8
- * @return {Object} - The loaded SSL options containing key and cert.
9
- */
10
- function loadSslConfig(sslOptions) {
11
- if (!sslOptions || !sslOptions.key || !sslOptions.cert) {
12
- throw new Error('SSL key and certificate paths must be provided');
13
- }
14
- return {
15
- key: fs.readFileSync(sslOptions.key),
16
- cert: fs.readFileSync(sslOptions.cert)
17
- };
18
- }
19
-
20
- module.exports = loadSslConfig;
1
+ const fs = require('fs');
2
+
3
+ /**
4
+ * Load SSL configuration
5
+ * @param {Object} sslOptions - The SSL options object containing the paths to key and cert files.
6
+ * @param {string} sslOptions.key - Path to the SSL key file.
7
+ * @param {string} sslOptions.cert - Path to the SSL certificate file.
8
+ * @return {Object} - The loaded SSL options containing key and cert.
9
+ */
10
+ function loadSslConfig(sslOptions) {
11
+ if (!sslOptions || !sslOptions.key || !sslOptions.cert) {
12
+ throw new Error('SSL key and certificate paths must be provided');
13
+ }
14
+ return {
15
+ key: fs.readFileSync(sslOptions.key),
16
+ cert: fs.readFileSync(sslOptions.cert)
17
+ };
18
+ }
19
+
20
+ module.exports = loadSslConfig;
@@ -1,39 +1,39 @@
1
- /**
2
- * Represents the base class for a WebSocket message handler.
3
- */
4
- class BaseHandler {
5
- /**
6
- * Creates a new handler instance.
7
- * @param {string} name - The name of the Handler, used in the client 'type' arg of request e.g {"type": "<handler-name>", ...}
8
- */
9
- constructor(name) {
10
- /**
11
- * he name of the Handler, used in the client 'type' arg of request e.g {"type": "<handler-name>", ...}.
12
- * @type {string}
13
- */
14
- this.name = name;
15
- }
16
- /**
17
- * Handles an incoming message and routes it to the appropriate handler function.
18
- * @param {WebSocket & {sendJson: (message: Object) => void, broadcast: (message: Object) => void}} socket - The WebSocket connection that sent the message.
19
- * @param {any} message - The incoming message in parsed JSON.
20
- */
21
- handleMessage(socket, message) {
22
- this.onMessage(socket, message);
23
- }
24
-
25
- /**
26
- * Method to be overriden to process messages.
27
- * @param {WebSocket} socket - The WebSocket connection that sent the message.
28
- * @param {any} message - The incoming message in parsed JSON.
29
- */
30
- onMessage(socket, message) {
31
- throw "Not yet implemented!";
32
- }
33
-
34
- onInitialContact(socket) {
35
-
36
- }
37
- }
38
-
39
- module.exports = { BaseHandler };
1
+ /**
2
+ * Represents the base class for a WebSocket message handler.
3
+ */
4
+ class BaseHandler {
5
+ /**
6
+ * Creates a new handler instance.
7
+ * @param {string} name - The name of the Handler, used in the client 'type' arg of request e.g {"type": "<handler-name>", ...}
8
+ */
9
+ constructor(name) {
10
+ /**
11
+ * he name of the Handler, used in the client 'type' arg of request e.g {"type": "<handler-name>", ...}.
12
+ * @type {string}
13
+ */
14
+ this.name = name;
15
+ }
16
+ /**
17
+ * Handles an incoming message and routes it to the appropriate handler function.
18
+ * @param {WebSocket & {sendJson: (message: Object) => void, broadcast: (message: Object) => void}} socket - The WebSocket connection that sent the message.
19
+ * @param {any} message - The incoming message in parsed JSON.
20
+ */
21
+ handleMessage(socket, message) {
22
+ this.onMessage(socket, message);
23
+ }
24
+
25
+ /**
26
+ * Method to be overriden to process messages.
27
+ * @param {WebSocket} socket - The WebSocket connection that sent the message.
28
+ * @param {any} message - The incoming message in parsed JSON.
29
+ */
30
+ onMessage(socket, message) {
31
+ throw "Not yet implemented!";
32
+ }
33
+
34
+ onInitialContact(socket) {
35
+
36
+ }
37
+ }
38
+
39
+ module.exports = { BaseHandler };
@@ -1,62 +1,76 @@
1
- /**
2
- * @typedef {Object} SocketServerOptions
3
- * @property {import('http').Server} [server] HTTP server to bind to
4
- * @property {number} [port=3000] Port to listen on
5
- * @property {Array<new () => import('./SocketRoute').SocketRoute>} [routes]
6
- */
7
-
8
- const DefaultRoute = require('./DefaultRoute');
9
-
10
- const SOCKET_OPTIONS = {
11
- port: 3000,
12
- ssl: null,
13
- routes: []
14
- };
15
-
16
- /**
17
- * Base WebSocket server
18
- */
19
- class BaseSocketServer {
20
- /**
21
- * @param {import('http').Server} server
22
- * @param {SocketServerOptions} [options]
23
- */
24
- constructor(server, options = {}) {
25
- this.clients = new Map();
26
- Object.assign(this, { ...SOCKET_OPTIONS, ...options });
27
- this.server = server;
28
-
29
- /* ─── ROUTE INITIALISATION ─────────────────────────── */
30
- if (!options.routes?.length) options.routes = [DefaultRoute];
31
- this.routes = options.routes.map(RouteClass => new RouteClass(server));
32
-
33
- this.server.on('upgrade', this.handleUpgrade.bind(this));
34
- }
35
-
36
- handleUpgrade(req, sock, head) {
37
- const route = this.routes.find(r => r.path === req.url);
38
- if (!route) return sock.destroy();
39
-
40
- route.server.handleUpgrade(req, sock, head, (s, r) =>
41
- route.server.emit('connection', s, r)
42
- );
43
- }
44
-
45
- /**
46
- * Dynamically attach a new route at runtime
47
- * @param {new () => import('./SocketRoute').SocketRoute} RouteClass
48
- */
49
- addRoute(RouteClass) {
50
- this.routes.push(new RouteClass(this.server));
51
- }
52
-
53
- /**
54
- * Gracefully tear down all routes (and their services)
55
- */
56
- shutdown() {
57
- this.routes.forEach(route => route.shutdown?.());
58
- this.server.close();
59
- }
60
- }
61
-
62
- module.exports = { BaseSocketServer, SOCKET_OPTIONS };
1
+ /**
2
+ * @typedef {Object} SocketServerOptions
3
+ * @property {import('http').Server} [server] HTTP server to bind to
4
+ * @property {number} [port=3000] Port to listen on
5
+ * @property {Array<new () => import('./SocketRoute').SocketRoute>} [routes]
6
+ */
7
+
8
+ const DefaultRoute = require('./DefaultRoute');
9
+
10
+ const SOCKET_OPTIONS = {
11
+ port: 3000,
12
+ ssl: null,
13
+ routes: []
14
+ };
15
+
16
+ /**
17
+ * Base WebSocket server
18
+ */
19
+ class BaseSocketServer {
20
+ /**
21
+ * @param {import('http').Server} server
22
+ * @param {SocketServerOptions} [options]
23
+ */
24
+ constructor(server, options = {}) {
25
+ this.clients = new Map();
26
+ Object.assign(this, { ...SOCKET_OPTIONS, ...options });
27
+ this.server = server;
28
+
29
+ /* ─── ROUTE INITIALISATION ─────────────────────────── */
30
+ if (!options.routes?.length) options.routes = [DefaultRoute];
31
+ this.routes = options.routes.map(RouteClass => new RouteClass(server));
32
+
33
+ this.server.on('upgrade', this.handleUpgrade.bind(this));
34
+ }
35
+
36
+ handleUpgrade(req, sock, head) {
37
+ // Some websocket clients (e.g., certain UE plugins) are finicky about the
38
+ // HTTP upgrade path they send. Normalise the path and fall back to a default
39
+ // route so we can still complete the upgrade instead of tearing the socket down.
40
+ const path = (() => {
41
+ try {
42
+ return new URL(req.url, `http://${req.headers.host || 'localhost'}`).pathname;
43
+ } catch {
44
+ return req.url;
45
+ }
46
+ })();
47
+
48
+ const route =
49
+ this.routes.find(r => r.path === path) ||
50
+ this.routes.find(r => r.path === '/');
51
+
52
+ if (!route) return sock.destroy();
53
+
54
+ route.server.handleUpgrade(req, sock, head, (s, r) =>
55
+ route.server.emit('connection', s, r)
56
+ );
57
+ }
58
+
59
+ /**
60
+ * Dynamically attach a new route at runtime
61
+ * @param {new () => import('./SocketRoute').SocketRoute} RouteClass
62
+ */
63
+ addRoute(RouteClass) {
64
+ this.routes.push(new RouteClass(this.server));
65
+ }
66
+
67
+ /**
68
+ * Gracefully tear down all routes (and their services)
69
+ */
70
+ shutdown() {
71
+ this.routes.forEach(route => route.shutdown?.());
72
+ this.server.close();
73
+ }
74
+ }
75
+
76
+ module.exports = { BaseSocketServer, SOCKET_OPTIONS };
@@ -1,14 +1,14 @@
1
- const { BaseHandler } = require("./BaseHandler");
2
- const { sendJson } = require("./util");
3
-
4
- class DefaultHandler extends BaseHandler {
5
- constructor() {
6
- super("DefaultHandler");
7
- }
8
-
9
- onMessage(socket, message) {
10
- socket.send(sendJson(`I got your message of ${JSON.stringify(message)}`));
11
- }
12
- }
13
-
1
+ const { BaseHandler } = require("./BaseHandler");
2
+ const { sendJson } = require("./util");
3
+
4
+ class DefaultHandler extends BaseHandler {
5
+ constructor() {
6
+ super("DefaultHandler");
7
+ }
8
+
9
+ onMessage(socket, message) {
10
+ socket.send(sendJson(`I got your message of ${JSON.stringify(message)}`));
11
+ }
12
+ }
13
+
14
14
  module.exports = DefaultHandler;
@@ -1,14 +1,14 @@
1
- const SocketRoute = require("./SocketRoute");
2
- const DefaultHandler = require('./DefaultHandler');
3
-
4
- class DefaultRoute extends SocketRoute {
5
- constructor(server) {
6
- super({
7
- server,
8
- path: "/",
9
- handlers: [DefaultHandler]
10
- })
11
- }
12
- }
13
-
1
+ const SocketRoute = require("./SocketRoute");
2
+ const DefaultHandler = require('./DefaultHandler');
3
+
4
+ class DefaultRoute extends SocketRoute {
5
+ constructor(server) {
6
+ super({
7
+ server,
8
+ path: "/",
9
+ handlers: [DefaultHandler]
10
+ })
11
+ }
12
+ }
13
+
14
14
  module.exports = DefaultRoute;
@@ -1,20 +1,20 @@
1
- const https = require('https');
2
- const loadSslConfig = require('../sslConfig');
3
- const { BaseSocketServer } = require('./BaseSocketServer');
4
-
5
- /**
6
- * Secure WebSocket Server
7
- * @param {SocketServerOptions} options - Configuration options for SecureSocketServer.
8
- * @return {Object} WebSocket server instance.
9
- */
10
- class SecureSocketServer extends BaseSocketServer {
11
- constructor(options = {}) {
12
- const sslOptions = loadSslConfig(options.ssl);
13
- const server = https.createServer(sslOptions);
14
- super(server, options);
15
- server.listen(this.port, () => console.log(`RedWeb SecureSocketServer listening on port ${this.port}`));
16
- return this;
17
- }
18
- }
19
-
20
- module.exports = SecureSocketServer;
1
+ const https = require('https');
2
+ const loadSslConfig = require('../sslConfig');
3
+ const { BaseSocketServer } = require('./BaseSocketServer');
4
+
5
+ /**
6
+ * Secure WebSocket Server
7
+ * @param {SocketServerOptions} options - Configuration options for SecureSocketServer.
8
+ * @return {Object} WebSocket server instance.
9
+ */
10
+ class SecureSocketServer extends BaseSocketServer {
11
+ constructor(options = {}) {
12
+ const sslOptions = loadSslConfig(options.ssl);
13
+ const server = https.createServer(sslOptions);
14
+ super(server, options);
15
+ server.listen(this.port, () => console.log(`RedWeb SecureSocketServer listening on port ${this.port}`));
16
+ return this;
17
+ }
18
+ }
19
+
20
+ module.exports = SecureSocketServer;