Skip to main content
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 codeDescription
E_INVALID_PROTOCOL_FORMAT

Protocol data had an invalid format.

E_UNSUPPORTED_SUBPROTOCOL

Server does not accept any of the sub-protocols specified by the application.

E_UNSUPPORTED_EXTENSION

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

Websocket.h

Library

Websocket.lib

DLL

Websocket.dll

See also

WebSocketBeginClientHandshake
WebSocketBeginServerHandshake
WebSocketEndServerHandshake
WEB_SOCKET_HTTP_HEADER

 

 

Microsoft 正在进行一项网上调查,以了解您对 网站的意见。如果您选择参加,我们将会在您离开 网站时向您显示该网上调查。

是否要参加?