TsgcWebSocketServerMethods › DisconnectAll

DisconnectAll Method

Disconnects every active client connection while keeping the server listening for new connections.

Syntax

public void DisconnectAll();

Remarks

DisconnectAll walks the internal connection list under a lock and calls DisconnectPeer on each active client, dropping the sockets at the TCP level without sending a WebSocket Close frame. The server keeps listening for new incoming connections; this method does not stop or unbind the server. OnDisconnect fires once for each client that is closed. The method is invoked automatically when the server stops, but you can call it at any time to forcibly clear the session table (for example after a configuration change or when draining a pool for restart).

Example


oServer.DisconnectAll();

Back to Methods