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

# XblMatchmakingCreateMatchTicketAsync

> XblMatchmakingCreateMatchTicketAsync

# XblMatchmakingCreateMatchTicketAsync

向服务器发送匹配请求，并返回带有票证 ID 的匹配票证。完成后调用 XblMatchmakingCreateMatchTicketResult 以获取结果。

## 语法

```cpp theme={null}
HRESULT XblMatchmakingCreateMatchTicketAsync(  
         XblContextHandle xboxLiveContext,  
         XblMultiplayerSessionReference ticketSessionReference,  
         const char* matchmakingServiceConfigurationId,  
         const char* hopperName,  
         const uint64_t ticketTimeout,  
         XblPreserveSessionMode preserveSession,  
         const char* ticketAttributesJson,  
         XAsyncBlock* asyncBlock  
)  
```

### 参数

*xboxLiveContext*   \_In\_\
类型：[XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

本地用户的 XBOX Live 上下文。

*ticketSessionReference*   \_In\_\
类型：[XblMultiplayerSessionReference](/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayersessionreference)

用于匹配的多玩家会话。

*matchmakingServiceConfigurationId*   \_In\_\
类型：char\*

用于匹配的服务配置 ID。

*hopperName*   \_In\_\
类型：char\*

hopper 的名称。

*ticketTimeout*   \_In\_\
类型：uint64\_t

等待玩家加入会话的最长时间。

*preserveSession*   \_In\_\
类型：[XblPreserveSessionMode](/reference/live/xsapi-c/matchmaking_c/enums/xblpreservesessionmode)

指示是否应保留会话。

*ticketAttributesJson*   \_In\_\
类型：char\*

会话的票证属性。(可选)

*asyncBlock*   \_In\_\
类型：XAsyncBlock\*

此操作的 AsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的 HRESULT 返回代码。

## 备注

匹配票证对象包含服务器返回的信息(如票证 ID 和等待时间)，还包含来自票证数据对象的标题指定数据的副本。

## REST 调用

调用 V103 POST /serviceconfigs/{serviceConfigId}/hoppers/{hopperName}

## 要求

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

**库：** Microsoft.Xbox.Services.14x.GDK.C.lib

## 另请参阅

[matchmaking\_c](/reference/live/xsapi-c/matchmaking_c/matchmaking_c_members)


## Related topics

- [XblMatchmakingCreateMatchTicketResult](/zh-CN/reference/live/xsapi-c/matchmaking_c/functions/xblmatchmakingcreatematchticketresult.md)
- [从 MPSD 迁移到 PlayFab Multiplayer 和 MPA](/zh-CN/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-to-mlp.md)
- [使用 SmartMatch 匹配](/zh-CN/services/xbox-services/multiplayer/matchmaking/concepts/live-matchmaking-how-tos.md)
- [在 Partner Center 中配置匹配](/zh-CN/services/xbox-services/multiplayer/matchmaking/config/live-matchmaking-config.md)
- [多人游戏任务](/zh-CN/services/xbox-services/multiplayer/mpsd/how-to/live-mpsd-how-tos.md)
