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

# XblMultiplayerSessionProperties

> XblMultiplayerSessionProperties

# XblMultiplayerSessionProperties

与此会话关联的一组属性。任何玩家都可以修改这些属性。

## 语法

```cpp theme={null}
typedef struct XblMultiplayerSessionProperties {  
    const char** Keywords;  
    size_t KeywordCount;  
    XblMultiplayerSessionRestriction JoinRestriction;  
    XblMultiplayerSessionRestriction ReadRestriction;  
    uint32_t* TurnCollection;  
    size_t TurnCollectionCount;  
    const char* MatchmakingTargetSessionConstantsJson;  
    const char* SessionCustomPropertiesJson;  
    const char* MatchmakingServerConnectionString;  
    const char** ServerConnectionStringCandidates;  
    size_t ServerConnectionStringCandidatesCount;  
    uint32_t* SessionOwnerMemberIds;  
    size_t SessionOwnerMemberIdsCount;  
    XblDeviceToken HostDeviceToken;  
    bool Closed;  
    bool Locked;  
    bool AllocateCloudCompute;  
    bool MatchmakingResubmit;  
} XblMultiplayerSessionProperties  
```

### 成员

*Keywords*\
类型：const char\*\*

与会话关联的关键字集合（可选，可以为空）。

*KeywordCount*\
类型：size\_t

关键字的数量。

*JoinRestriction*\
类型：[XblMultiplayerSessionRestriction](/reference/live/xsapi-c/multiplayer_c/enums/xblmultiplayersessionrestriction)

限制谁可以加入"open"会话。（对预留没有影响，这意味着它对"private"和"visible"会话没有影响。）默认为"none"。如果为"local"，则只允许其令牌的 DeviceId 与会话中其他已"active": true 的用户匹配的用户加入。如果为"followed"，则只允许本地用户（如上定义）和被会话中现有（非预留）成员关注的用户在无需预留的情况下加入。

*ReadRestriction*\
类型：[XblMultiplayerSessionRestriction](/reference/live/xsapi-c/multiplayer_c/enums/xblmultiplayersessionrestriction)

限制谁可以读取"open"会话。（对预留没有影响，这意味着它对"private"和"visible"会话没有影响。）默认为"none"。如果为"local"，则只允许其令牌的 DeviceId 与会话中其他已"active": true 的用户匹配的用户读取。如果为"followed"，则只允许本地用户（如上定义）和被会话中现有（非预留）成员关注的用户在无需预留的情况下读取。读取限制适用于具有"open"或"visible"可见性的会话，并决定谁可以在没有邀请的情况下读取该会话。读取限制必须至少与加入限制同样宽松，即，在未同时设置 'readRestriction' 的情况下，'joinRestriction' 不能设置为"followed"。"

*TurnCollection*\
类型：uint32\_t\*

指示轮到谁的会话 MemberId 集合。

*TurnCollectionCount*\
类型：size\_t

TurnCollection 数组中的条目数量。

*MatchmakingTargetSessionConstantsJson*\
类型：const char\*

表示目标会话常量的 JSON 字符串。

*SessionCustomPropertiesJson*\
类型：const char\*

指定会话自定义属性的 JSON 字符串。这些属性可以随时更改。更改时，请调用 multiplayer\_service::write\_session 将更改写入服务。

*MatchmakingServerConnectionString*\
类型：const char\*

强制使用特定的连接字符串。这对于加入进行中会话的场景非常有用。

*ServerConnectionStringCandidates*\
类型：const char\*\*

会话可用于连接到游戏服务器的连接字符串的有序列表。通常游戏应使用列表中的第一个，但复杂的游戏可以使用自定义机制来选择其他连接字符串（例如，基于负载）。

*ServerConnectionStringCandidatesCount*\
类型：size\_t

ServerConnectionStringCandidates 数组中的条目数量。

*SessionOwnerMemberIds*\
类型：uint32\_t\*

会话所有者的会话 MemberId。

*SessionOwnerMemberIdsCount*\
类型：size\_t

SessionOwnerMemberIds 数组中的条目数量。

*HostDeviceToken*\
类型：[XblDeviceToken](/reference/live/xsapi-c/multiplayer_c/structs/xbldevicetoken)

主机的设备令牌。必须与至少一个成员的"deviceToken"匹配，否则将删除此字段。如果设置了"peerToHostRequirements"并且设置了"host"，则测量阶段假定给定的主机是正确的主机，并且仅测量到该主机的指标。

*Closed*\
类型：bool

控制会话是否可加入，独立于可见性、加入限制和会话中可用空间。不影响预留。默认为 false。

*Locked*\
类型：bool

如果为 true，将允许锁定会话成员，这样如果某个用户离开，他们仍然能够回到会话中，但没有其他用户可以占用该位置。默认为 false。

*AllocateCloudCompute*\
类型：bool

客户端将此设置为 true 会触发 MPSD 进行 XBOX Live Compute 分配尝试。默认为 false。

*MatchmakingResubmit*\
类型：bool

如果找到的匹配未成功，需要重新提交，则为 true。设置为 false 以表明匹配已成功，匹配服务可以释放会话。

## 要求

**头文件：** multiplayer\_c.h

## 另请参阅

[multiplayer\_c](/reference/live/xsapi-c/multiplayer_c/multiplayer_c_members)


## Related topics

- [多人游戏会话高级主题](/zh-CN/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-details.md)
- [XblMultiplayerSessionSessionProperties](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionsessionproperties.md)
- [XblMultiplayerSessionPropertiesSetKeywords](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionpropertiessetkeywords.md)
- [XblMultiplayerSessionDeleteCustomPropertyJson](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessiondeletecustompropertyjson.md)
- [XblMultiplayerSessionPropertiesSetJoinRestriction](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionpropertiessetjoinrestriction.md)
