TsgcWebSocketClient | Client Close Connection

Connection can be closed using Active property, Stop or Disconnect methods, read more from Client Open Connection.

 

CleanDisconnect

When a connection is closed, you can notify the other peer that the connection is being closed by sending a close message. To enable this feature, set the Options.CleanDisconnect property to true.

If this property is enabled, before the connection is closed, a Close message will be sent to the server to notify that the client is closing the connection.

 

Disconnect

TsgcWSConnection has a method called Disconnect(), that allows you to disconnect the connection at the socket level. If you call this method, the socket will be disconnected directly without waiting for any response from the server. You can send a Close Code with this method.

 

Close

TsgcWSConnection has a method called Close(), which allows you to send a message to the server requesting to close the connection. If the server receives this message, it must close the connection and the client will receive a notification that the connection is closed. You can send a Close Code with this method.