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

# HCTraceSetClientCallback

> Registers a callback that receives libHttpClient trace messages.

Registers a callback that receives libHttpClient trace messages. After you register a callback, libHttpClient can call it until trace cleanup removes it.

## Syntax

```cpp theme={null}
bool HCTraceSetClientCallback(  
         HCTraceCallback* callback  
)  
```

### Parameters

*callback*   \_In\_opt\_\
Type: [HCTraceCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecallback.md)\*

Trace callback to register.

### Return value

Type: bool

For a non-null callback, returns `true` if the callback was registered, or `false` if all 10 callback slots are occupied. In that case, the callback isn't registered and doesn't receive trace messages.

Passing `nullptr` registers no callback and removes none. It returns `true` if an empty slot is available, or `false` if all slots are occupied.

## Remarks

You can register up to 10 client callbacks. Register each callback only once. Registering the same callback again uses another slot, and the callback then receives each message once per registration.

Passing `nullptr` doesn't remove a registered callback. Each direct call to [HCTraceCleanup](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecleanup.md) removes all client callbacks. Final library teardown with [HCCleanupAsync](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hccleanupasync.md) also reaches trace cleanup and removes them. Removing the registrations doesn't wait for a callback that's already running. Register your callback again after you reinitialize libHttpClient.

For threading rules and parameter details, see [HCTraceCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecallback.md).

## Requirements

**Header:** trace.h

**Library:** libHttpClient.lib

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

## See also

[trace](https://docs.xbox.com/reference/live/httpclient/trace/trace_members.md)\
[HCTraceCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecallback.md)\
[HCSettingsSetTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/functions/hcsettingssettracelevel.md)\
[HCTraceCleanup](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecleanup.md)


## Related topics

- [HCTraceCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecallback.md)
- [trace (contents)](https://docs.xbox.com/reference/live/httpclient/trace/trace_members.md)
- [HCSettingsSetTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/functions/hcsettingssettracelevel.md)
- [Debug Tracing](https://docs.xbox.com/services/playfab/sdks/c/tracing.md)
- [Multiplayer FAQ and troubleshooting](https://docs.xbox.com/services/xbox-services/multiplayer/mpsd/concepts/live-multiplayer-2015-faq.md)
