WebSocketEndClientHandshake function
The WebSocketEndClientHandshake function completes the client-side handshake.
Syntax
HRESULT WINAPI WebSocketEndClientHandshake(
_In_ WEB_SOCKET_HANDLE hWebSocket,
_In_ const PWEB_SOCKET_HTTP_HEADER pResponseHeaders,
_In_ ULONG ulReponseHeaderCount,
_Inout_opt_ ULONG *pulSelectedExtensions,
_Inout_opt_ ULONG *pulSelectedExtensionCount,
_Inout_opt_ ULONG *pulSelectedSubprotocol
);
Parameters
- hWebSocket [in]
-
Type: WEB_SOCKET_HANDLE
WebSocket session handle returned by a previous call to WebSocketCreateClientHandle.
- pResponseHeaders [in]
-
Type: const PWEB_SOCKET_HTTP_HEADER
Pointer to an array or WEB_SOCKET_HTTP_HEADER structures that contain the response headers received by the application.
- ulReponseHeaderCount [in]
-
Type: ULONG
Number of response headers in pResponseHeaders.
- pulSelectedExtensions [in, out, optional]
-
Type: ULONG*
On input, pointer to an array allocated by the application. On successful output, pointer to an array of numbers that represent the extensions chosen by the server during the client-server handshake. These number are the zero-based indices into the extensions array passed to pszExtensions in WebSocketBeginClientHandshake.
- pulSelectedExtensionCount [in, out, optional]
-
Type: ULONG*
On input, number of extensions allocated in pulSelectedExtensions. This must be at least equal to the number passed to ulExtensionCount in WebSocketEndClientHandshake. On successful output, number of extensions returned in pulSelectedExtensions.
- pulSelectedSubprotocol [in, out, optional]
-
Type: ULONG*
On successful output, pointer to a number that represents the sub-protocol chosen by the server during the client-server handshake. This number is the zero-based index into the sub-protocols array passed to pszSubprotocols in WebSocketBeginClientHandshake.
Return value
Type: HRESULT
If the function succeeds, it returns S_OK.
If the function fails, it returns one of the following or a system error code defined in WinError.h.
| Return code | Description |
|---|---|
|
Protocol data had an invalid format. |
|
Server does not accept any of the sub-protocols specified by the application. |
|
Server does not accept extensions specified by the application. |
Remarks
This function must be called to complete the client-side handshake after a previous call to WebSocketBeginClientHandshake. Once the client-server handshake is complete, the application may use the session functions.
Requirements
|
Minimum supported client | Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- WebSocketBeginClientHandshake
- WebSocketBeginServerHandshake
- WebSocketEndServerHandshake
- WEB_SOCKET_HTTP_HEADER