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 WebSocketBeginClientHandshake function begins the client-side handshake.
Syntax
HRESULT WebSocketBeginClientHandshake(
[in] WEB_SOCKET_HANDLE hWebSocket,
[in, optional] PCSTR *pszSubprotocols,
[in] ULONG ulSubprotocolCount,
[in, optional] PCSTR *pszExtensions,
[in] ULONG ulExtensionCount,
[in, optional] const PWEB_SOCKET_HTTP_HEADER pInitialHeaders,
[in] ULONG ulInitialHeaderCount,
[out] PWEB_SOCKET_HTTP_HEADER *pAdditionalHeaders,
[out] ULONG *pulAdditionalHeaderCount
);
Parameters
[in] hWebSocket
Type: WEB_SOCKET_HANDLE
WebSocket session handle returned by a previous call to WebSocketCreateClientHandle.
[in, optional] pszSubprotocols
Type: PCSTR*
Pointer to an array of sub-protocols chosen by the application. Once the client-server handshake is complete, the application must use the sub-protocol returned by WebSocketEndClientHandshake. Must contain one subprotocol per entry.
[in] ulSubprotocolCount
Type: ULONG
Number of sub-protocols in pszSubprotocols.
[in, optional] pszExtensions
Type: PCSTR*
Pointer to an array of extensions chosen by the application. Once the client-server handshake is complete, the application must use the extension returned by WebSocketEndClientHandshake. Must contain one extension per entry.
[in] ulExtensionCount
Type: ULONG
Number of extensions in pszExtensions.
[in, optional] pInitialHeaders
Type: const PWEB_SOCKET_HTTP_HEADER
Pointer to an array of WEB_SOCKET_HTTP_HEADER structures that contain the request headers to be sent by the application. The array must include the Host HTTP header as defined in RFC 2616.
[in] ulInitialHeaderCount
Type: ULONG
Number of request headers in pInitialHeaders.
[out] pAdditionalHeaders
Type: PWEB_SOCKET_HTTP_HEADER
On successful output, pointer to an array of WEB_SOCKET_HTTP_HEADER structures that contain the request headers to be sent by the application. If any of these headers were specified in pInitialHeaders, the header must be replaced.
[out] pulAdditionalHeaderCount
Type: ULONG*
On successful output, number of response headers in pAdditionalHeaders.
Return value
Type: HRESULT
If the function succeeds, it returns S_OK.
If the function fails, it returns a system error code defined in WinError.h.
Remarks
To complete the client-side handshake, applications must call WebSocketEndClientHandshake. 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 |