MCPcopy Index your code
hub / github.com/socketio/socket.io / close

Method close

lib/index.ts:744–763  ·  view source on GitHub ↗

* Closes server connection * * @param [fn] optional, called as `fn([err])` on error OR all conns closed

(fn?: (err?: Error) => void)

Source from the content-addressed store, hash-verified

742 * @param [fn] optional, called as `fn([err])` on error OR all conns closed
743 */
744 public close(fn?: (err?: Error) => void): void {
745 this._nsps.forEach((nsp) => {
746 nsp.sockets.forEach((socket) => {
747 socket._onclose("server shutting down");
748 });
749
750 nsp.adapter.close();
751 });
752
753 this.engine.close();
754
755 // restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
756 restoreAdapter();
757
758 if (this.httpServer) {
759 this.httpServer.close(fn);
760 } else {
761 fn && fn();
762 }
763 }
764
765 /**
766 * Registers a middleware, which is a function that gets executed for every incoming {@link Socket}.

Callers 15

createChildMethod · 0.45
utility-methods.tsFile · 0.45
close.tsFile · 0.45
socket.tsFile · 0.45
middleware.tsFile · 0.45
uws.tsFile · 0.45
namespaces.tsFile · 0.45
server-close.tsFile · 0.45
successFunction · 0.45
todo.tests.tsFile · 0.45

Calls 3

restoreAdapterFunction · 0.90
fnFunction · 0.85
_oncloseMethod · 0.80

Tested by

no test coverage detected