WebSocketCloseAsync Method (CloseStatusCode, String) |
Namespace: Sfs2X.WebSocketSharp
public void CloseAsync( CloseStatusCode code, string reason )
One of the CloseStatusCode enum values.
It represents the status code indicating the reason for the close.
A String that represents the reason for the close.
The size must be 123 bytes or less in UTF-8.
Exception | Condition |
---|---|
ArgumentException | code is ServerError. It cannot be used by clients. -or- code is MandatoryExtension. It cannot be used by servers. -or- code is NoStatus and there is reason. -or- reason could not be UTF-8-encoded. |
ArgumentOutOfRangeException | The size of reason is greater than 123 bytes. |
This method does not wait for the close to be complete.
This method does nothing if the current state of the connection is Closing or Closed.