> ## 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.

# HCSetWebSocketFunctions

> HCSetWebSocketFunctions

# HCSetWebSocketFunctions

選擇性地允許呼叫端實作 WebSocket 函式。

## 語法

```cpp theme={null}
HRESULT HCSetWebSocketFunctions(  
         HCWebSocketConnectFunction websocketConnectFunc,  
         HCWebSocketSendMessageFunction websocketSendMessageFunc,  
         HCWebSocketSendBinaryMessageFunction websocketSendBinaryMessageFunc,  
         HCWebSocketDisconnectFunction websocketDisconnectFunc,  
         void* context  
)  
```

### 參數

*websocketConnectFunc*   \_In\_\
類型：HCWebSocketConnectFunction

依需求實作 WebSocket 連線函式的回呼。傳入 nullptr 以使用以目前平台為基礎的預設實作。

*websocketSendMessageFunc*   \_In\_\
類型：HCWebSocketSendMessageFunction

依需求實作 WebSocket 傳送訊息函式的回呼。傳入 nullptr 以使用以目前平台為基礎的預設實作。

*websocketSendBinaryMessageFunc*   \_In\_\
類型：HCWebSocketSendBinaryMessageFunction

依需求實作 WebSocket 傳送二進位訊息函式的回呼。傳入 nullptr 以使用以目前平台為基礎的預設實作。

*websocketDisconnectFunc*   \_In\_\
類型：HCWebSocketDisconnectFunction

依需求實作 WebSocket 中斷連線函式的回呼。傳入 nullptr 以使用以目前平台為基礎的預設實作。

*context*   \_In\_opt\_\
類型：void\*

回呼的內容指標。

### 傳回值

類型：HRESULT

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

## 需求

**標頭：** httpProvider.h

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

## 另請參閱

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


## Related topics

- [HCWebSocketSetHeader](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetheader.md)
- [HCWebSocketSetProxyUri](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetproxyuri.md)
- [HCWebSocketSetBinaryMessageFragmentEventFunction](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetbinarymessagefragmenteventfunction.md)
- [HCWebSocketSetProxyDecryptsHttps](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetproxydecryptshttps.md)
- [HCWebSocketSetMaxReceiveBufferSize](/zh-TW/reference/live/httpclient/httpclient/functions/hcwebsocketsetmaxreceivebuffersize.md)
