Skip to main content

HCWebSocketGetResponseHeaderAtIndex

Gets the name and value of the response header at a zero-based index from the completed WebSocket connect operation.

Syntax

Parameters

websocket   _In_
Type: HCWebsocketHandle
The handle of the WebSocket. headerIndex   _In_
Type: uint32_t
The zero-based index of the response header. Must be less than the count that HCWebSocketGetNumResponseHeaders returns. headerName   _Outptr_result_z_
Type: const char**
Receives the UTF-8 encoded name of the response header. The string remains valid until you call HCWebSocketCloseHandle on the handle. headerValue   _Outptr_result_z_
Type: const char**
Receives the UTF-8 encoded value of the response header. The string remains valid until you call HCWebSocketCloseHandle on the handle.

Return value

Type: HRESULT Result code for this API operation. Possible values are S_OK, E_INVALIDARG, or E_FAIL.

Remarks

Call this function only after the WebSocket connect operation has completed. If the provider captured response headers for a refused or otherwise failed connection attempt, you can query them until you call HCWebSocketCloseHandle. To find out how many response headers there are, call HCWebSocketGetNumResponseHeaders. If headerIndex is out of range, the function returns E_INVALIDARG and sets headerName and headerValue to nullptr. The function also returns E_INVALIDARG if websocket, headerName, or headerValue is nullptr.

Requirements

Header: httpClient.h Library: libHttpClient.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

httpClient
HCWebSocketGetNumResponseHeaders
HCWebSocketGetResponseHeader
Last modified on October 30, 2026