The WinHttpWebSocketClose function closes a WebSocket connection.
WINHTTPAPI DWORD WinHttpWebSocketClose( HINTERNET hWebSocket, USHORT usStatus, PVOID pvReason, DWORD dwReasonLength );
Handle to a WebSocket.
A close status code. See WINHTTP_WEB_SOCKET_CLOSE_STATUS for possible values.
A detailed reason for the close.
The length of pvReason, in bytes.
If pvReason is NULL, this must be 0. This value must be within the range of 0 to 123.
With the following exception, all error codes indicate that the underlying TCP connection has been aborted.
||A close or send is pending.|
||A parameter is invalid.|
||Invalid data was received from the server.|
WinHttpWebSocketClose completely closes a WebSocket connection. To close the send channel while still leaving the receive channel open, use WinHttpWebSocketShutdown.
It is possible to receive a close frame during regular receive operations. In this case, WinHttpWebSocketClose will also send a close frame.
The close timer can be set by the property WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT. The default is 10 seconds.
|Minimum supported client||Windows 8 [desktop apps only]|
|Minimum supported server||Windows Server 2012 [desktop apps only]|