diff --git a/lib/Server.js b/lib/Server.js index f8d0ac4..34cf1d8 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -136,12 +136,14 @@ class Server extends EventEmitter { if (this.clientOptions.log.level >= this.LOGLEVEL.NORMAL) { this.clientOptions.log.stdLog('Closing all connections and exiting...'); } - + + const server = this.webSocketServer._server; this.webSocketServer.close(() => { this.activeConnections.forEach((activeConnection) => { activeConnection.close(); }); - }); + }); + server.close(); } newConnection(webSocketConnection) {