Skip to content

Commit

Permalink
Add SocketAuthority.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
mikiher committed Dec 27, 2023
1 parent 0d0bdce commit 21d0d43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions server/SocketAuthority.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 21d0d43

Please sign in to comment.