WebSocketBeginClientHandshake function

The WebSocketBeginClientHandshake function begins the client-side handshake.

Syntax


HRESULT WINAPI WebSocketBeginClientHandshake(
  _In_      WEB_SOCKET_HANDLE hWebSocket,
  _In_opt_  PCSTR *pszSubprotocols,
  _In_      ULONG ulSubprotocolCount,
  _In_opt_  PCSTR *pszExtensions,
  _In_      ULONG ulExtensionCount,
  _In_opt_  const PWEB_SOCKET_HTTP_HEADER pInitialHeaders,
  _In_      ULONG ulInitialHeaderCount,
  _Out_     PWEB_SOCKET_HTTP_HEADER pAdditionalHeaders,
  _Out_     ULONG *pulAdditionalHeaderCount
);

Parameters

hWebSocket [in]

Type: WEB_SOCKET_HANDLE

WebSocket session handle returned by a previous call to WebSocketCreateClientHandle.

pszSubprotocols [in, optional]

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.

ulSubprotocolCount [in]

Type: ULONG

Number of sub-protocols in pszSubprotocols.

pszExtensions [in, optional]

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.

ulExtensionCount [in]

Type: ULONG

Number of extensions in pszExtensions.

pInitialHeaders [in, optional]

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.

ulInitialHeaderCount [in]

Type: ULONG

Number of request headers in pInitialHeaders.

pAdditionalHeaders [out]

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.

pulAdditionalHeaderCount [out]

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

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

WebSocketBeginServerHandshake
WebSocketEndClientHandshake
WebSocketEndServerHandshake
WEB_SOCKET_HTTP_HEADER

 

 

Community Additions

ADD
Show:
© 2014 Microsoft