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

# XblSocialRelationshipChangedHandler

> Defines a callback that's invoked when a social relationship changes.

# XblSocialRelationshipChangedHandler

A callback invoked when a social relationship changes.

## Syntax

```cpp theme={null}
typedef void (STDAPIVCALLTYPE* XblSocialRelationshipChangedHandler)(  
         _In_ const XblSocialRelationshipChangeEventArgs* eventArgs,  
         _In_opt_ void* context  
);  
```

### Parameters

*eventArgs*   \_In\_\
Type: [const XblSocialRelationshipChangeEventArgs\*](https://docs.xbox.com/reference/live/xsapi-c/social_c/structs/xblsocialrelationshipchangeeventargs.md)

The arguments associated with the relationship change. The fields of the structure, including the `xboxUserIds` array, are valid only during the callback.

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

The context that was provided when the handler was added.

### Return value

Type: void

## Remarks

Register this callback by calling [XblSocialAddSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddsocialrelationshipchangedhandler.md). The *context* parameter receives the *handlerContext* value that you passed when you registered the handler.

The `socialNotification` member of *eventArgs* is `XblSocialNotificationType::Added`, `XblSocialNotificationType::Changed`, or `XblSocialNotificationType::Removed`. Copy any XBOX user IDs that you need after the callback returns.

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

You don't need to subscribe to social relationship changes separately. When you add the handler, the XBOX Services API (XSAPI) creates a Real-Time Activity (RTA) subscription for the context's user, or reuses the existing one.

## Argument of

[XblSocialAddSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddsocialrelationshipchangedhandler.md)

## 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)\
[XblSocialRelationshipChangeEventArgs](https://docs.xbox.com/reference/live/xsapi-c/social_c/structs/xblsocialrelationshipchangeeventargs.md)\
[XblSocialRemoveSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler.md)


## Related topics

- [XblSocialAddSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddsocialrelationshipchangedhandler.md)
- [social_c (contents)](https://docs.xbox.com/reference/live/xsapi-c/social_c/social_c_members.md)
- [XblSocialRemoveSocialRelationshipChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler.md)
- [XblSocialAddFriendRequestCountChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialaddfriendrequestcountchangedhandler.md)
- [XblSocialRemoveFriendRequestCountChangedHandler](https://docs.xbox.com/reference/live/xsapi-c/social_c/functions/xblsocialremovefriendrequestcountchangedhandler.md)
