mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 18:44:17 +00:00
added close event
This commit is contained in:
parent
56f3d95423
commit
c7a712e25f
@ -122,6 +122,11 @@ class Server {
|
|||||||
// output server info
|
// output server info
|
||||||
console.log(`✅ Server is up and running!`)
|
console.log(`✅ Server is up and running!`)
|
||||||
this.consoleOutputServerInfo()
|
this.consoleOutputServerInfo()
|
||||||
|
|
||||||
|
// handle exit events
|
||||||
|
process.on("SIGTERM", this.cleanupProcess)
|
||||||
|
process.on("SIGINT", this.cleanupProcess)
|
||||||
|
process.on("exit", this.cleanupProcess)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWSClientConnection = async (socket) => {
|
handleWSClientConnection = async (socket) => {
|
||||||
@ -288,6 +293,13 @@ class Server {
|
|||||||
"HTTP port": this.HTTPlistenPort,
|
"HTTP port": this.HTTPlistenPort,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanupProcess = () => {
|
||||||
|
console.log("🔴 Stopping server...")
|
||||||
|
|
||||||
|
this.httpInterface.close()
|
||||||
|
this.wsInterface.io.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Server
|
module.exports = Server
|
Loading…
x
Reference in New Issue
Block a user