Add SocketAuthority.close()

This commit is contained in:
mikiher 2023-12-27 15:33:33 +02:00
parent 0d0bdce337
commit 21d0d43edc
2 changed files with 10 additions and 1 deletions

View File

@ -401,7 +401,7 @@ class Server {
Logger.info('Watcher Closed')
return new Promise((resolve) => {
this.server.close((err) => {
SocketAuthority.close((err) => {
if (err) {
Logger.error('Failed to close server', err)
} else {

View File

@ -73,6 +73,15 @@ class SocketAuthority {
}
}
close(callback) {
Logger.info('[SocketAuthority] Shutting down')
// This will close all open socket connections, and also close the underlying http server
if (this.io)
this.io.close(callback)
else
callback()
}
initialize(Server) {
this.Server = Server