> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HCWebSocketGetHeaderAtIndex

> HCWebSocketGetHeaderAtIndex

# HCWebSocketGetHeaderAtIndex

获取 WebSocket 中指定从零开始索引处的标头。

## Syntax

```cpp theme={null}
HRESULT HCWebSocketGetHeaderAtIndex(  
         HCWebsocketHandle websocket,  
         uint32_t headerIndex,  
         const char** headerName,  
         const char** headerValue  
)  
```

### Parameters

*websocket*   \_In\_\
Type: HCWebsocketHandle

WebSocket 的句柄。

*headerIndex*   \_In\_\
Type: uint32\_t

标头的特定从零开始的索引。

*headerName*   \_Out\_\
Type: char\*\*

HTTP 调用的 UTF-8 编码标头名称。

*headerValue*   \_Out\_\
Type: char\*\*

HTTP 调用的 UTF-8 编码标头值。

### Return value

Type: HRESULT

此 API 操作的结果代码。可能的值为 S\_OK、E\_INVALIDARG 或 E\_FAIL。

## Remarks

使用 HCHttpCallGetNumHeaders() 可获知 HTTP 调用中有多少个标头。

## Requirements

**Header:** httpProvider.h

**Library:** libHttpClient.GDK.lib

## See also

[httpProvider](/reference/live/httpclient/httpprovider/httpprovider_members)


## Related topics

- [HCWebSocketGetHeader](/zh-CN/reference/live/httpclient/httpprovider/functions/hcwebsocketgetheader.md)
- [HCWebSocketGetNumHeaders](/zh-CN/reference/live/httpclient/httpprovider/functions/hcwebsocketgetnumheaders.md)
- [HCWebSocketSetHeader](/zh-CN/reference/live/httpclient/httpclient/functions/hcwebsocketsetheader.md)
- [HCGetWebSocketFunctions](/zh-CN/reference/live/httpclient/httpprovider/functions/hcgetwebsocketfunctions.md)
- [HCWebSocketGetEventFunctions](/zh-CN/reference/live/httpclient/httpclient/functions/hcwebsocketgeteventfunctions.md)
