Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WebSocket.CloseOutputAsync Method

.NET Framework 4.6 and 4.5

Initiates or completes the close handshake defined in the WebSocket protocol specification section 7.

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

public abstract Task CloseOutputAsync(
	WebSocketCloseStatus closeStatus,
	string statusDescription,
	CancellationToken cancellationToken


Type: System.Net.WebSockets.WebSocketCloseStatus

Indicates the reason for closing the WebSocket connection.

Type: System.String

Allows applications to specify a human readable explanation as to why the connection is closed.

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 output on the WebSocket has been closed.

.NET Framework

Supported in: 4.6, 4.5
© 2015 Microsoft