Compartir a través de


XblMultiplayerManagerGameSessionSetSynchronizedProperties

Sets the value of a custom property for the game session, using XblMultiplayerSessionWriteMode::SynchronizedUpdate.

Syntax

HRESULT XblMultiplayerManagerGameSessionSetSynchronizedProperties(  
         const char* name,  
         const char* valueJson,  
         void* context  
)  

Parameters

name   _In_z_
Type: char*

The name of the custom property to set.

valueJson   _In_z_
Type: char*

The value to assign to the property, as a JSON string.

context   _In_opt_
Type: void*

Optional. The application-defined data to correlate the XblMultiplayerEvent to the initiating call.

Return value

Type: HRESULT

HRESULT return code for this API operation.

Remarks

This function sets the value, represented as a JSON string, of a custom property for the game session. Custom properties can be changed at any time. If custom properties are shared between devices, or may be updated by several devices at the same time, use this function to ensure atomicity and resolve any conflicts between devices while changing the values of those cusotm properties. If a custom property isn't shared across devices, use the XblMultiplayerManagerGameSessionSetProperties function instead to change the value of that custom property.
The service may reject the request to change the custom property if a race condition occurs due to a conflict. If the request is rejected, the service returns HTTP_E_STATUS_PRECOND_FAILED. If a conflict occurs, re-evaluate the need to change the custom property and, if needed, call this function again to re-submit the request.
The result of this function is delivered as a multiplayer event with an event type set to XblMultiplayerEventType::SessionSynchronizedPropertyWriteCompleted. You can call XblMultiplayerManagerDoWork to retrieve multiplayer events.

Requirements

Header: multiplayer_manager_c.h

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

See also

multiplayer_manager_c
XblMultiplayerManagerGameSessionSetSynchronizedHost
XblMultiplayerEvent