check if httpInterface has a close function

This commit is contained in:
srgooglo 2022-05-13 11:48:17 +02:00
parent 65d987fa51
commit 203ed30c92

View File

@ -24,6 +24,8 @@ const HTTPEngines = {
return require("nanoexpress")() return require("nanoexpress")()
}, },
"express": () => { "express": () => {
return require("express")() return require("express")()
}, },
} }
@ -287,7 +289,10 @@ class Server {
cleanupProcess = () => { cleanupProcess = () => {
console.log("🛑 Stopping server...") console.log("🛑 Stopping server...")
this.httpInterface.close() if (typeof this.httpInterface.close === "function") {
this.httpInterface.close()
}
this.wsInterface.io.close() this.wsInterface.io.close()
process.exit(1) process.exit(1)
@ -368,6 +373,7 @@ class Server {
console.log(`🌐 Server info:`) console.log(`🌐 Server info:`)
console.table({ console.table({
"ID": this.id, "ID": this.id,
"HTTPEngine": this.params.httpEngine,
"Version": LINEBRIDGE_SERVER_VERSION, "Version": LINEBRIDGE_SERVER_VERSION,
"HTTP address": this.HTTPAddress, "HTTP address": this.HTTPAddress,
"WS address": this.WSAddress, "WS address": this.WSAddress,