WebSocket::CloseAsync Method (WebSocketCloseStatus, String^, CancellationToken)
.NET Framework (current version)
Closes the WebSocket connection as an asynchronous operation using the close handshake defined in the WebSocket protocol specification section 7.
Assembly: System (in System.dll)
public: virtual Task^ CloseAsync( WebSocketCloseStatus closeStatus, String^ statusDescription, CancellationToken cancellationToken ) abstract
Parameters
- closeStatus
-
Type:
System.Net.WebSockets::WebSocketCloseStatus
Indicates the reason for closing the WebSocket connection.
- statusDescription
-
Type:
System::String^
Specifies a human readable explanation as to why the connection is closed.
- cancellationToken
-
Type:
System.Threading::CancellationToken
The token that can be used to propagate notification that operations should be canceled.
Return Value
Type: System.Threading.Tasks::Task^Returns Task.
The task object representing the asynchronous operation.
This operation will not block. The returned Task object will complete after the WebSocket has been closed.
This method closes the WebSocket connection using the close handshake defined in the WebSocket protocol specification section 7.
.NET Framework
Available since 4.5
Available since 4.5
Show: