We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 748e18c commit bf64870Copy full SHA for bf64870
lib/index.ts
@@ -742,13 +742,17 @@ export class Server<
742
* @param [fn] optional, called as `fn([err])` on error OR all conns closed
743
*/
744
public close(fn?: (err?: Error) => void): void {
745
- for (const socket of this.sockets.sockets.values()) {
746
- socket._onclose("server shutting down");
747
- }
+ this._nsps.forEach((nsp) => {
+ nsp.sockets.forEach((socket) => {
+ socket._onclose("server shutting down");
748
+ });
749
+
750
+ nsp.adapter.close();
751
752
753
this.engine.close();
754
- // restore the Adapter prototype
755
+ // restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
756
restoreAdapter();
757
758
if (this.httpServer) {
0 commit comments