Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The WebSocketEndClientHandshake function completes the client-side handshake.
Syntax
HRESULT WebSocketEndClientHandshake(
[in] WEB_SOCKET_HANDLE hWebSocket,
[in] const PWEB_SOCKET_HTTP_HEADER pResponseHeaders,
[in] ULONG ulReponseHeaderCount,
[in, out, optional] ULONG *pulSelectedExtensions,
[in, out, optional] ULONG *pulSelectedExtensionCount,
[in, out, optional] ULONG *pulSelectedSubprotocol
);
Parameters
[in] hWebSocket
Type: WEB_SOCKET_HANDLE
WebSocket session handle returned by a previous call to WebSocketCreateClientHandle.
[in] pResponseHeaders
Type: const PWEB_SOCKET_HTTP_HEADER
Pointer to an array of WEB_SOCKET_HTTP_HEADER structures that contain the response headers received by the application.
[in] ulReponseHeaderCount
Type: ULONG
Number of response headers in pResponseHeaders.
[in, out, optional] pulSelectedExtensions
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.
[in, out, optional] pulSelectedExtensionCount
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.
[in, out, optional] pulSelectedSubprotocol
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
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps only] |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | websocket.h |
Library | Websocket.lib |
DLL | Websocket.dll |