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

# XblRealTimeActivityAddConnectionStateChangeHandler

> XblRealTimeActivityAddConnectionStateChangeHandler

# XblRealTimeActivityAddConnectionStateChangeHandler

Registers a handler function to receive a notification that is sent when the client service loses or gains connectivity to the real time activity service.

## Syntax

```cpp theme={null}
XblFunctionContext XblRealTimeActivityAddConnectionStateChangeHandler(  
         XblContextHandle xboxLiveContext,  
         XblRealTimeActivityConnectionStateChangeHandler* handler,  
         void* context  
)  
```

### Parameters

*xboxLiveContext*   \_In\_\
Type: [XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

XBOX Live context handle.

*handler*   \_In\_\
Type: XblRealTimeActivityConnectionStateChangeHandler\*

The callback function that receives notifications.

*context*   \_In\_opt\_\
Type: void\*

Caller context that will be passed back to the handler function.

### Return value

Type: XblFunctionContext

An XblFunctionContext object that can be used to unregister the event handler.

## Requirements

**Header:** real\_time\_activity\_c.h

**Library:** Microsoft.Xbox.Services.14x.GDK.C.lib

## See also

[real\_time\_activity\_c](/reference/live/xsapi-c/real_time_activity_c/real_time_activity_c_members)


## Related topics

- [XblRealTimeActivityConnectionStateChangeHandler](/reference/live/xsapi-c/real_time_activity_c/functions/xblrealtimeactivityconnectionstatechangehandler.md)
- [XblRealTimeActivityRemoveConnectionStateChangeHandler](/reference/live/xsapi-c/real_time_activity_c/functions/xblrealtimeactivityremoveconnectionstatechangehandler.md)
- [XblRealTimeActivityConnectionState](/reference/live/xsapi-c/real_time_activity_c/enums/xblrealtimeactivityconnectionstate.md)
- [XblRealTimeActivityAddResyncHandler](/reference/live/xsapi-c/real_time_activity_c/functions/xblrealtimeactivityaddresynchandler.md)
- [Multiplayer Session Directory overview](/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
