Commit bf64870 1 parent 748e18c commit bf64870 Copy full SHA for bf64870
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -742,13 +742,17 @@ export class Server<
742
742
* @param [fn] optional, called as `fn([err])` on error OR all conns closed
743
743
*/
744
744
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
+ } ) ;
748
752
749
753
this . engine . close ( ) ;
750
754
751
- // restore the Adapter prototype
755
+ // restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
752
756
restoreAdapter ( ) ;
753
757
754
758
if ( this . httpServer ) {
You can’t perform that action at this time.
0 commit comments