# Canceling Matchmaking

You can cancel matchmaking at any time by using the `CancelKronosMatchmaking` node. All cleanup processes are handled automatically, such as canceling pending reservations and destroying pending sessions.

There is no hard requirement on where you need to call this from. Most games will probably have this hooked to the `OnClicked` event of a widget button.

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FM0MdARFQK9nJw5CRjFGS%2FCancelMatchmaking.jpg?alt=media&#x26;token=17b4dcd7-d714-48b3-92cd-9525e249f9ec" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
#include "KronosMatchmakingManager.h"
#include "KronosMatchmakingPolicy.h"
```

```cpp
// Get the matchmaking manager.
UKronosMatchmakingManager* MatchmakingManager = UKronosMatchmakingManager::Get(this);

// Check if we are matchmaking.
if (MatchmakingManager->IsMatchmaking())
{
    // Get the current matchmaking policy.
    // This is accessible even after matchmaking is canceled.
    UKronosMatchmakingPolicy* MatchmakingPolicy = MatchmakingManager->GetMatchmakingPolicy();

    // Begin canceling matchmaking.
    MatchmakingPolicy->CancelMatchmaking();
}
```

{% endtab %}
{% endtabs %}
