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

# XblSocialAddSocialRelationshipChangedHandler

> XblSocialAddSocialRelationshipChangedHandler

Registers an event handler for notifications of social relationship changes caused by the registering user.

## Syntax

```cpp theme={null}
XblFunctionContext XblSocialAddSocialRelationshipChangedHandler(  
         XblContextHandle xboxLiveContext,  
         XblSocialRelationshipChangedHandler handler,  
         void* handlerContext  
)  
```

### Parameters

*xboxLiveContext*   \_In\_\
Type: [XblContextHandle](https://docs.xbox.com/reference/live/xsapi-c/types_c/handles/xblcontexthandle.md)

An XBOX services context handle created with XblContextCreateHandle.

*handler*   \_In\_\
Type: [XblSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialrelationshipchangedhandler.md)

The callback function that receives notifications.

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

Client context pointer to be passed back to the handler.

### Return value

Type: XblFunctionContext

An XblFunctionContext used to remove the handler. Returns 0 and doesn't register a handler if *xboxLiveContext* or *handler* is null.

## Remarks

This handler triggers only if the user changes the relationship with another user. It doesn't trigger if another user changes the relationship with the user.

You don't need to subscribe to social relationship changes separately. When you register a handler, the XBOX Services API (XSAPI) creates a Real-Time Activity (RTA) subscription to social relationship notifications for the context's user, or reuses the existing one. Social relationship changed handlers and [friend request count handlers](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddfriendrequestcountchangedhandler.md) share this subscription. XSAPI removes the subscription only after you remove all handlers of both types for the context.

This handler doesn't receive changes to the number of incoming friend requests. To receive them, call [XblSocialAddFriendRequestCountChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddfriendrequestcountchangedhandler.md).

Call [XblSocialRemoveSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler.md) to unregister the event handler.

## Requirements

**Header:** social\_c.h

**Library:** Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

## See also

[social\_c](https://docs.xbox.com/reference/live/xsapi-c/social_c/social_c_members.md)


## Related topics

- [XblSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialrelationshipchangedhandler.md)
- [XblSocialRemoveSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler.md)
- [Handling a social relationship change](https://docs.xbox.com/services/xbox-services/community/people-system/how-to/live-handling-a-relationship-change.md)
- [XblSocialAddFriendRequestCountChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddfriendrequestcountchangedhandler.md)
- [social_c (contents)](https://docs.xbox.com/reference/live/xsapi-c/social_c/social_c_members.md)
