From 4c7a03441efff04878005be20d20aa38f2870eaf Mon Sep 17 00:00:00 2001 From: dnalborczyk Date: Thu, 22 Sep 2022 17:49:03 -0400 Subject: [PATCH] refactor: http server instantation for websockets --- src/events/websocket/HttpServer.js | 4 +++- src/events/websocket/WebSocket.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/events/websocket/HttpServer.js b/src/events/websocket/HttpServer.js index 15df7ce11..7533a54fa 100644 --- a/src/events/websocket/HttpServer.js +++ b/src/events/websocket/HttpServer.js @@ -15,8 +15,10 @@ export default class HttpServer { constructor(options, webSocketClients) { this.#options = options this.#webSocketClients = webSocketClients + } - const { host, websocketPort, httpsProtocol } = options + async createServer() { + const { host, websocketPort, httpsProtocol } = this.#options const serverOptions = { host, diff --git a/src/events/websocket/WebSocket.js b/src/events/websocket/WebSocket.js index 122328258..111ba67f3 100644 --- a/src/events/websocket/WebSocket.js +++ b/src/events/websocket/WebSocket.js @@ -29,6 +29,8 @@ export default class WebSocket { this.#httpServer = new HttpServer(this.#options, webSocketClients) + await this.#httpServer.createServer() + // share server this.#webSocketServer = new WebSocketServer( this.#options,