> ## 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 中位於特定以零起始之索引的標頭。

## 語法

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

### 參數

*websocket*   \_In\_\
類型：HCWebsocketHandle

WebSocket 的控制代碼。

*headerIndex*   \_In\_\
類型：uint32\_t

標頭的特定以零起始的索引。

*headerName*   \_Out\_\
類型：char\*\*

HTTP 呼叫的 UTF-8 編碼標頭名稱。

*headerValue*   \_Out\_\
類型：char\*\*

HTTP 呼叫的 UTF-8 編碼標頭值。

### 傳回值

類型：HRESULT

此 API 作業的結果代碼。可能的值為 S\_OK、E\_INVALIDARG 或 E\_FAIL。

## 備註

使用 HCHttpCallGetNumHeaders() 來得知 HTTP 呼叫中有多少個標頭。

## 需求

**標頭：** httpProvider.h

**程式庫：** libHttpClient.GDK.lib

## 另請參閱

[httpProvider](/zh-TW/reference/live/httpclient/httpprovider/httpprovider_members)


## Related topics

- [HCWebSocketGetHeader](/zh-TW/reference/live/httpclient/httpprovider/functions/hcwebsocketgetheader.md)
- [HCWebSocketGetNumHeaders](/zh-TW/reference/live/httpclient/httpprovider/functions/hcwebsocketgetnumheaders.md)
- [GDK 中的 HTTP 和 WebSocket Web 要求](/zh-TW/build/console-features/networking/web-requests/http-networking.md)
- [HCWebSocketSetHeader](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetheader.md)
- [HCWebSocketCreate](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketcreate.md)
