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