Skip to main content

Cancel Matchmaking

Last updated on

The party leader can cancel matchmaking before a match is found. The players will also be notified that the matchmaking process is canceled. To implement this feature, refer to the function below.

FString GameMode = FString("2v2");

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetCancelMatchmakingResponseDelegate(AccelByte::Api::Lobby::MatchmakingCancelResponse.CreateLambda([](const FAccelByteModelsMatchmakingResponse& Result)
{
if (Result.Code == "0")
{
// Do something if CancelMatchmakingResponseDelegate has been successful
}
else
{
// Do something if CancelMatchmakingResponseDelegate has an error
}
}));
FRegistry::Lobby.SendCancelMatchmaking(GameMode);