WebSocketBeginServerHandshake function

The WebSocketBeginServerHandshake function begins the server-side handshake.

Syntax


HRESULT WINAPI WebSocketBeginServerHandshake(
  _In_      WEB_SOCKET_HANDLE hWebSocket,
  _In_opt_  PCSTR pszSubprotocolSelected,
  _In_opt_  PCSTR *pszExtensionSelected,
  _In_      ULONG ulExtensionSelectedCount,
  _In_      const PWEB_SOCKET_HTTP_HEADER pRequestHeaders,
  _In_      ULONG ulRequestHeaderCount,
  _Out_     PWEB_SOCKET_HTTP_HEADER *pResponseHeaders,
  _Out_     ULONG *pulResponseHeaderCount
);

Parameters

hWebSocket [in]

Type: WEB_SOCKET_HANDLE

WebSocket session handle returned by a previous call to WebSocketCreateServerHandle.

pszSubprotocolSelected [in, optional]

Type: PCSTR

A pointer to a sub-protocol value chosen by the application. Must contain one subprotocol.

pszExtensionSelected [in, optional]

Type: PCSTR*

A pointer to a list of extensions chosen by the application. Must contain one extension per entry.

ulExtensionSelectedCount [in]

Type: ULONG

Number of extensions in pszExtensionSelected.

pRequestHeaders [in]

Type: const PWEB_SOCKET_HTTP_HEADER

Pointer to an array of WEB_SOCKET_HTTP_HEADER structures that contain the request headers received by the application.

ulRequestHeaderCount [in]

Type: ULONG

Number of request headers in pRequestHeaders.

pResponseHeaders [out]

Type: PWEB_SOCKET_HTTP_HEADER*

On successful output, a pointer to an array or WEB_SOCKET_HTTP_HEADER structures that contain the response headers to be sent by the application.

pulResponseHeaderCount [out]

Type: ULONG*

On successful output, number of response headers in pResponseHeaders.

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.

 

Remarks

To complete the server-side handshake, applications must call WebSocketEndServerHandshake or any of the session functions. 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
WebSocketEndClientHandshake
WebSocketEndServerHandshake
WEB_SOCKET_HTTP_HEADER

 

 

Community Additions

ADD
Show:
© 2014 Microsoft