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

# MultiplayerSession (JSON)

> MultiplayerSession (JSON)

# MultiplayerSession (JSON)

表示 **MultiplayerSession** 的 JSON 对象。

MultiplayerSession JSON 对象具有以下规范。

| 成员 | 类型 | 说明 |
| - | - | - |
| constants | object | 与会话模板合并以生成会话常量的只读设置。 |
| properties | object | 要合并到会话属性中的更改。 |
| members.me | object | 常量和属性,其工作方式与顶层同名项非常相似。任何 PUT 方法都要求用户是会话的成员,如有必要会将该用户添加进来。如果将 “me” 指定为 null,则会将发出请求的成员从会话中移除。 |
| members | object | 表示要添加到会话中的用户的其他对象,以从零开始的索引作为键。请求中的成员数始终从 0 开始,即使会话已经包含成员也是如此。成员按其在请求中出现的顺序添加到会话中。成员属性只能由属于自己的用户设置。 |
| servers | object | 指示对会话所关联服务器参与者集合的更新和添加的值。如果将某服务器指定为 null,则会将该服务器项从会话中移除。 |

## JSON 语法示例

```json theme={null}
{
      "properties": {
        "system": {
          "turn": []
        },
        "custom": {
          "KANWE": "MGMSY"
        }
      },
      "constants": {
        "system": {
          "visibility": "open"
        },
        "custom": {}
      },
      "servers": {},
      "members": {
        "first": 0,
        "end": 1,
        "count": 1,
        "accepted": 0,
        "0": {
          "next": 1,
          "pending": true,
          "properties": {
            "system": {},
            "custom": {}
          },
          "constants":  {
            "system": {
              "xuid": 5500461
            },
            "custom": {
              "8216": "WXMRJ"
            }
          }
        }
      },
      "key": "8d050174-412b-4d51-a29b-d55a34edfdb7~integration~bcd0088d76a94c60be4b75f139243a1f"
    }
  
    
```

## 请求结构

有关与此 JSON 规范关联的请求结构,请参阅 [MultiplayerSessionRequest (JSON)](https://devdocs.xbox.com/zh-CN/reference/live/rest/json/json-multiplayersessionrequest)。

## 响应结构

```json theme={null}
{
  // The contract version of this rendering of the session. A function of the contract version of the request and constants/system/version.
  "contractVersion": 107,

  // The branch and change number of the session as of this rendering.
  "branch": "bd6c41c3-01c3-468a-a3b5-3e0fe8133862",
  "changeNumber": 5,

  // Use for tracing.
  // If an empty session is deleted and then restarted, the correlation ID will remain the same.
  "correlationId": "0fe81338-ee96-46e3-a3b5-2dbbd6c41c3b",

  // The time that the session began.
  // If an empty session is deleted and then restarted, this time will be the time of the restart.
  "startTime": "2009-06-15T13:45:30.0900000Z",

  // If any timeouts are in progress, this is the time that the next one will fire.
  "nextTimer": "2009-06-15T13:45:30.0900000Z",

  // Present during member initialization.
  // The "stage" goes from "joining" to "measuring" to "evaluating".
  // If episode #1 fails, then "stage" is set to "failed" and the session cannot be initialized.
  // Otherwise, when an initialization episode completes, the "initializing" object is removed.
  // If "autoEvaluate" is set, "evaluating" is skipped. If neither "metrics" nor "measurementServerAddresses" is set, "measuring" is skipped.
  "initializing": {
    "stage": "measuring",
    "stageStartTime": "2009-06-15T13:45:30.0900000Z",
    "episode": 1
  },

  // Set after the "measuring" stage of initialization episode #1, if "peerToHostRequirements" is set and no /properties/system/host is set.
  // Cleared once a /properties/system/host is set.
  // Host candidates are device tokens listed in order, order of preference.
  "hostCandidates": [ "ab90a362", "99582e67" ],

  "constants": { /* Property Bag */ },
  "properties": { /* Property Bag */ },

  "members": {
    // On large sessions, at most one entry is present, "me".
    "1": {
      "constants": { /* Property Bag */ },
      "properties": { /* Property Bag */ },
      // Only if the member has accepted. Optional (not set if no gamertag claim was found).
      "gamertag": "stacy",
      // This is set when the member uploads a secure device address. It's a case-insensitive string that can be used for equality comparisons.
      "deviceToken": "9f4032ba7",
      // This is set to "open", "moderate", or "strict" when the member uploads a V1.x secure device address.
      "nat": "strict",
      // This value is removed once the user does their first PUT to the session.
      "reserved": true,
      // If the member is active, this is the title in which they are active, in decimal.
      "activeTitleId": "8397267",
      // The time the user joined the session. If "reserved" is true, the time the reservation was made.
      "joinTime": "2009-06-15T13:45:30.0900000Z",
      // Present if this member is in the /properties/system/turn array, otherwise not.
      "turn": true,

      // Set when transitioning out of the "joining" or "measuring" stage if this member doesn't pass.
      // In order of precedence, could be set to "timeout", "latency", "bandwidthdown", "bandwidthup", "network", "group", or "episode".
      // The "network" value means the network configuration and/or conditions (such as conflicting NAT) prevented the QoS metrics from being measured.
      // The only possible value at the end of "joining" is "group". (On timeout from "joining", the reservation is removed.)
      // The "episode" value is set after a failed "evaluation" stage on all members of the initialization episode that didn't fail during "joining" or "measuring".
      "initializationFailure": "latency",

      // If "memberInitialization" is set and the member was added with "initialize": true, this is set to the initialization episode that the member will participate in.
      // One is a special value used for the members added to a new session at create time.
      // Removed when the initialization episode ends.
      "initializationEpisode": 1,

      // The next member's index, which is the same as 'next' below if there's no more.
      "next": 4
    },
    "4": { "next": 5 /* etc */ }
  },

  "membersInfo": {
    "first": 1,  // The first member's index.
    "next": 5,  // The index that the next member added will get.
    "count": 2,  // The number of members.
    "accepted": 1  // The number of members that are no longer 'reserved'.
  },

  "servers": {
    "name": {
      "constants": { /* Property Bag */ },
      "properties": { /* Property Bag */ }
    }
  }
}
    
```

## 另请参阅

##### 父主题

[JavaScript 对象表示法 (JSON) 对象参考](https://devdocs.xbox.com/zh-CN/reference/live/rest/json/atoc-xboxlivews-reference-json)


## Related topics

- [Multiplayer Session Directory overview](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Multiplayer Session Directory 개요](https://devdocs.xbox.com/ko/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Visão geral do Multiplayer Session Directory](https://devdocs.xbox.com/pt-BR/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Información general de Multiplayer Session Directory](https://devdocs.xbox.com/es/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Vue d'ensemble de Multiplayer Session Directory](https://devdocs.xbox.com/fr-CA/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
