Click or drag to resize

WebSocketCloseAsync Method (CloseStatusCode, String)

Closes the connection asynchronously with the specified code and reason.

Namespace:  Sfs2X.WebSocketSharp
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public void CloseAsync(
	CloseStatusCode code,
	string reason
)

Parameters

code
Type: Sfs2X.WebSocketSharpCloseStatusCode

One of the CloseStatusCode enum values.

It represents the status code indicating the reason for the close.

reason
Type: SystemString

A String that represents the reason for the close.

The size must be 123 bytes or less in UTF-8.

Exceptions
ExceptionCondition
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.
Remarks

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.

See Also