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

# HCWebSocketGetPingInterval

> Gets the keepalive ping interval set for a WebSocket.

# HCWebSocketGetPingInterval

Gets the keepalive ping interval, in seconds, that the title set for a WebSocket.

## Syntax

```cpp theme={null}
HRESULT HCWebSocketGetPingInterval(
         HCWebsocketHandle websocket,
         uint32_t* pingIntervalSeconds
)
```

### Parameters

*websocket*   \_In\_\
Type: HCWebsocketHandle

The handle of the WebSocket.

*pingIntervalSeconds*   \_Out\_\
Type: uint32\_t\*

Receives the ping interval, in seconds. Receives 0 if the title didn't set an interval.

### Return value

Type: HRESULT

Returns `S_OK` on success, or `E_INVALIDARG` if `websocket` or `pingIntervalSeconds` is `nullptr`.

## Remarks

The title sets the interval with [HCWebSocketSetPingInterval](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcwebsocketsetpinginterval.md) before it calls [HCWebSocketConnectAsync](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcwebsocketconnectasync.md).

This function returns the value that the title requested. If you implement [HCWebSocketConnectFunction](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hcwebsocketconnectfunction.md), call this function to read the interval and configure keepalive frames. On Windows and XBOX consoles, the built-in implementation sets the WinHTTP WebSocket keepalive interval only when the value is greater than 0, and raises values from 1 through 14 to 15 seconds, the WinHTTP minimum keepalive interval. When the value is 0, the built-in implementation keeps the WinHTTP default.

This function isn't declared when `HC_NOWEBSOCKETS` is defined.

## Requirements

**Header:** httpProvider.h

**Library:** libHttpClient.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[httpProvider](https://docs.xbox.com/reference/live/httpclient/httpprovider/httpprovider_members.md)\
[HCWebSocketConnectFunction](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hcwebsocketconnectfunction.md)\
[HCWebSocketSetPingInterval](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcwebsocketsetpinginterval.md)


## Related topics

- [HCWebSocketSetPingInterval](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcwebsocketsetpinginterval.md)
- [HCWebSocketConnectFunction](https://docs.xbox.com/reference/live/httpclient/httpprovider/functions/hcwebsocketconnectfunction.md)
- [httpProvider (contents)](https://docs.xbox.com/reference/live/httpclient/httpprovider/httpprovider_members.md)
- [HCWebSocketCreate](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcwebsocketcreate.md)
- [httpClient (contents)](https://docs.xbox.com/reference/live/httpclient/httpclient/httpclient_members.md)
