System.Net.WebSockets.WebSocket.CloseAsync Method

Closes the WebSocket connection as an asynchronous operation using the close handshake defined in the tp://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-06 section 7.

Syntax

public abstract System.Threading.Tasks.Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, System.Threading.CancellationToken cancellationToken)

Parameters

closeStatus
Indicates the reason for closing the WebSocket connection.
statusDescription
Specifies a human readable explanation as to why the connection is closed.
cancellationToken
The token that can be used to propagate notification that operations should be canceled.

Returns

Returns System.Threading.Tasks.Task.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned System.Threading.Tasks.Task object will complete after the WebSocket has been closed.

This method closes the WebSocket connection using the close handshake defined in the tp://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-06 section 7.

Requirements

Namespace: System.Net.WebSockets
Assembly: System (in System.dll)
Assembly Versions: 4.0.0.0