From a5bde05b4eac62815c7c91183c68106521bd2685 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 25 Mar 2025 22:46:41 +0000 Subject: [PATCH] delete engine params on init --- src/server.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/server.js b/src/server.js index 37bad9d..bc431e0 100755 --- a/src/server.js +++ b/src/server.js @@ -133,18 +133,6 @@ class Server { } } - const engineParams = { - ...this.params, - handleWsUpgrade: this.handleWsUpgrade, - handleWsConnection: this.handleWsConnection, - handleWsDisconnect: this.handleWsDisconnect, - handleWsAuth: this.handleWsAuth, - handleAuth: this.handleHttpAuth, - requireAuth: this.constructor.requireHttpAuth, - refName: this.constructor.refName ?? this.params.refName, - ssl: this.ssl, - } - // initialize engine this.engine = Engines[this.params.useEngine] @@ -152,10 +140,10 @@ class Server { throw new Error(`Engine ${this.params.useEngine} not found`) } - this.engine = new this.engine(engineParams, this) + this.engine = new this.engine(this) if (typeof this.engine.initialize === "function") { - await this.engine.initialize(engineParams) + await this.engine.initialize() } // check if ws events are defined @@ -229,14 +217,14 @@ class Server { } // listen - await this.engine.listen(engineParams) + await this.engine.listen() // calculate elapsed time on ms, to fixed 2 const elapsedHrTime = process.hrtime(startHrTime) const elapsedTimeInMs = elapsedHrTime[0] * 1e3 + elapsedHrTime[1] / 1e6 console.info( - `🛰 Server ready!\n\t - ${this.params.http_protocol}://${this.params.listen_ip}:${this.params.listen_port} \n\t - Tooks ${elapsedTimeInMs.toFixed(2)}ms`, + `🛰 Server ready!\n\t - ${this.params.http_protocol}://${this.params.listen_ip}:${this.params.listen_port} \n\t - Tooks ${elapsedTimeInMs.toFixed(2)}ms \n\t - Websocket: ${this.engine.ws ? "Enabled" : "Disabled"}`, ) }