WebSocket.CloseOutputAsync(WebSocketCloseStatus, String, CancellationToken) 方法

定義

啟始或完成 WebSocket 通訊協定規格第 7 節中定義的關閉信號交換。Initiates or completes the close handshake defined in the WebSocket protocol specification section 7.

public:
 abstract System::Threading::Tasks::Task ^ CloseOutputAsync(System::Net::WebSockets::WebSocketCloseStatus closeStatus, System::String ^ statusDescription, System::Threading::CancellationToken cancellationToken);
public abstract System.Threading.Tasks.Task CloseOutputAsync (System.Net.WebSockets.WebSocketCloseStatus closeStatus, string statusDescription, System.Threading.CancellationToken cancellationToken);
abstract member CloseOutputAsync : System.Net.WebSockets.WebSocketCloseStatus * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task

參數

closeStatus
WebSocketCloseStatus

表示關閉 WebSocket 連線的原因。Indicates the reason for closing the WebSocket connection.

statusDescription
String

可讓應用程式就連線關閉的原因指定人類看得懂的說明。Allows applications to specify a human readable explanation as to why the connection is closed.

cancellationToken
CancellationToken

可用來傳播應該取消作業之通知的語彙基元。The token that can be used to propagate notification that operations should be canceled.

傳回

工作物件,表示非同步作業。The task object representing the asynchronous operation.

備註

這項作業不會封鎖。This operation will not block. 傳回的 Task 物件將在 WebSocket 上的輸出關閉後完成。The returned Task object will complete after the output on the WebSocket has been closed.

適用於