Skip to content

Commit bf64870

Browse files
1 parent 748e18c commit bf64870

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/index.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,17 @@ export class Server<
742742
* @param [fn] optional, called as `fn([err])` on error OR all conns closed
743743
*/
744744
public close(fn?: (err?: Error) => void): void {
745-
for (const socket of this.sockets.sockets.values()) {
746-
socket._onclose("server shutting down");
747-
}
745+
this._nsps.forEach((nsp) => {
746+
nsp.sockets.forEach((socket) => {
747+
socket._onclose("server shutting down");
748+
});
749+
750+
nsp.adapter.close();
751+
});
748752

749753
this.engine.close();
750754

751-
// restore the Adapter prototype
755+
// restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
752756
restoreAdapter();
753757

754758
if (this.httpServer) {

0 commit comments

Comments
 (0)