Matches

Note

Stability: 3 - Stable

Overview

Hydra’s Match feature is designed to offer you a place to store data about a battle/game between multiple players. Matches are similar to profiles in the sense that they are treated as their own entity and allow you to store arbitrary data on them according to your needs.

Here is an example JSON response from a match:

{
   "rand":0.363403094845318,
   "account_id":"5102a78ae2c6625ed0000000",
   "data":{
      "stats":{
         "kills":22
      }
   },
   "created_at":"2013-02-06 21:19:47",
   "updated_at":"2013-02-06 21:19:47",
   "access":"private",
   "players":[
      {
         "identity":{
            "username":"SomeUsername"
         },
         "state":"join",
         "account_id":"5102a78ae2c6625ed0000000",
      },
      {
         "identity":{
            "username":"AnotherUsername"
         },
         "state":"invite",
         "account_id":"5102abf8e2c6625ed000000a",
      }
   ],
   "state":"open",
   "key":"8342984942304c5b1df7a5fdded6ba9a0bcf50616419dc8f10c1c426b1cc6f58c62605e6f4e415fab58af1222096b80613255c6f2a8954cae2cf5a8a2dae1685",
   "max_players":8,
   "type":"async",
   "id":"5112c8f3e2c662286e000004",
   "name":"rough-rough-fog-dew-189f5"
}

Creating

Access

You can specify the level of access for a match when creating it.

Public :
Anyone can join the match. This game style works great if you wish users to pick a match from a list without needing to control who joins the match.
Private :
Only players invited by the creator of the match can join.
Matchmaking :
Automatically created as the result of an async Matchmaking request. Since these matches are only available after a matchmaking request there is no way to view or list them ahead of time. These are the ‘private’ matches of the matchmaking world.

You create matches by specifying the template to use and the access level.

  • AGPromise* create = [client.matchService createWithTemplate:templateSlug access:accessType];
    [create when:^(AGMatch* match) {
        // ...
    }];
    
  • client.Match.CreateNew(templateSlug, accessType, delegate(Match match, Request req)
    {
        // ...
    });
    
  • client.getMatchesService().createNew(templateSlug, accessType, new ObjectListener<Match>() {
        public void objectReceived(final Match match, Response r) {
             // ...
        }
    });
    
  • client->getMatchService().createNew(templateSlug, accessType, [] (std::shared_ptr<Match> match, Request* request) {
        // ...
    });
    
  • Documentation coming soon.

The Match Object

{
  "name":"rough-rough-fog-dew-189f5"
  "rand":0.363403094845318,
  "created_at":"2013-02-06 21:19:47",
  "updated_at":"2013-02-06 21:19:47",
  "key":"8342984942304c5b1df7a5fdded6ba9a0bcf50616419dc8f10c1c426b1cc6f58c62605e6f4e415fab58af1222096b80613255c6f2a8954cae2cf5a8a2dae1685",
  "max_players":8,
  "id":"5112c8f3e2c662286e000004",
}

Each match is made up of the following information: (most of these are exposed directly by each SDK)

name :
Randomly generated name, you can use this as you wish.
rand :
Pseudo randomly generated number from 0.0 - 1.0. You can use this to seed your match data.
created_at :
Date on which the match was created.
updated_at :
Date on which the match was last updated.
max_players :
How many players can be in this match.
key :
Key for this match’s realtime session. (See Realtime).
state :

The current state of the match.

open :
This match is available for others to join if there is room
abandoned :
Gameplay has finished with no results to track. This match is not available to join anymore.
complete :
Gameplay has finished with some result that needs to be tracked and/or analyzed (e.g. winners and losers). This match is not available to join anymore.

Updating

The data section of the match is yours to use however you see fit. You might use it for anything from just tracking stats in your game (so you can later show it on a website), full replay data, or as the main data source for your game. You can update this section of the match exactly how you would update profiles, see Working with Hydra Objects.

You may wish to just upload all of your match data at the end of a game or you can update it periodically throughout the match.

  • AGCommands* commands = [[AGCommands alloc] init];
    [commands incValue:[NSNumber numberWithInt:1] forKey:@"data.kills"];
    
    AGPromise* p = [match updateModelWithCommands:commands];
    [p when:^(AGRequest* request) {
        // ...
    }];
    
  • Commands commands = new Commands();
    commands.IncValue("data.kills", 1);
    
    match.Update(commands, delegate(Request req)
    {
        // ...
    });
    
  • Commands commands = new Commands();
    commands.incValue("data.kills", 1);
    
    match.update(commands, new ObjectListener<Match>() {
        @Override
        public void objectReceived(Match object, Response r) {
            // ...
        }
    });
    
  • Commands commands;
    commands.incValue("data.kills", new Integer(1));
    
    match->update(commands, [] (std::shared_ptr<Match> match, hydra::Request *request) {
        // ...
    });
    
  • Documentation coming soon.

You can then access updated data via the Data member. (See The Map Helper Object for more info)

  • kills = match.data[@"kills"];
    
  • kills = match.Data["kills"];
    
  • kills = match.getData().get("kills");
    
  • kills = match->getData()["kills"];
    
  • Documentation coming soon.

You can specify additional parameters to further customize your match update.

Notification :

This parameter allows you to trigger a custom event defined in the match template. Hydra will send the configured notification to the specified players via any available notification systems.

The Match Notification object is made up of:

Name :
The name of the custom event you want to trigger.
Recipient Preset :

An enumeration of predefined configurations for the players that should receive this notification.

Everyone :
This notification should go out to every player in the match, including the player that triggered the update.
Everyone but me :
This notification should go out to every player in the match, except for the player that triggered the update.
No one :
Do not send a notification to any player.
Custom :
This notification should go out to a custom list of players.
Recipient List :
A list of match players that should receive this notification. Only valid if the recipient preset is set to custom.
Data :
Any data you want to send to the clients that receive the update notification. Players receiving the update notification can access this data through the Match Updated event.

You can create a notification object from scratch, or use a built-in helper.

  • NSMutableArray* recipients = [[NSMutableArray alloc]initWithCapacity:1];
    // ...
    AGMatchNotification* custom = [[AGMatchNotification alloc]initWithName:eventName recipients:recipients];
    
    AGMatchNotification* helper1 = [AGMatchNotification toEveryone:eventName];
    AGMatchNotification* helper2 = [AGMatchNotification toEveryoneButMe:eventName];
    AGMatchNotification* helper3 = [AGMatchNotification none];
    
  • List<MatchPlayer> recipients = new List<MatchPlayer>();
    // ...
    MatchNotification custom = new MatchNotification(eventName, recipients);
    custom.Data = "Sample string data for this update notification";
    
    MatchNotification helper1 = MatchNotification.ToEveryone(eventName);
    MatchNotification helper2 = MatchNotification.ToEveryoneButMe(eventName);
    MatchNotification helper3 = MatchNotification.None;
    
  • List<MatchPlayer> recipients = new ArrayList<MatchPlayer>();
    // ...
    MatchNotification custom = new MatchNotification(eventName, recipients);
    custom.data = "Sample string data for this update notification";
    
    MatchNotification helper1 = MatchNotification.toEveryone(eventName);
    MatchNotification helper2 = MatchNotification.toEveryoneButMe(eventName);
    MatchNotification helper3 = MatchNotification.none();
    
  • std::vector<MatchPlayer> recipients;
    // ...
    MatchNotification custom(eventName, recipients);
    custom.data = "Sample string data for this update notification";
    
    MatchNotification helper1 = MatchNotification::toEveryone(eventName);
    MatchNotification helper2 = MatchNotification::toEveryoneButMe(eventName);
    MatchNotification helper3 = MatchNotification::none();
    
  • Documentation coming soon.
Winning Team :
This parameter allows you to set the list of players that are currently winning. This list will be used when a match expires and is auto-completed.
Fields :
This parameter allows you to request only a specific set of fields to be returned from the match update call.
  • AGPromise* p = [match updateWithCommands:commands fields:fields winningTeam:winningTeam notification:notification];
    [p when:^(AGRequest* request) {
        // ...
    }];
    
  • match.Update(commands, fields, winningTeam, notification, delegate(Request req)
    {
        // ...
    });
    
  • match.update(commands, fields, winningTeam, notification, new ObjectListener<Match>() {
        @Override
        public void objectReceived(Match object, Response r) {
            // ...
        }
    });
    
  • match->updateWithNotification(commands, fields, winningTeam, notification, [] (std::shared_ptr<Match> match, hydra::Request *request) {
        // ...
    });
    
  • Documentation coming soon.

Completing

Any player currently in the match can complete it (i.e. to set the winners and losers).

Inviting

The creator of a match can invite a user to the match by account id or username.

  • AGPromise *p = [match invite:accountId];
    [p when:^(AGRequest* req) {
        // ...
    }];
    
    AGPromise *p = [match inviteByUsername:username];
    [p when:^(AGRequest* req) {
        // ...
    }];
    
  • match.Invite(accountId, delegate(HydraRequest request)
    {
        // ...
    });
    
    match.InviteByUsername(username, delegate(HydraRequest request)
    {
        // ...
    });
    
  • match.invite(accountId, new ResponseListener() {
        public void responseReceived(Response r) {
            // ...
        }
    });
    
    match.inviteByUsername(username, new ResponseListener() {
        public void responseReceived(Response r) {
            // ...
        }
    });
    
  • match->invite(accountId, [] (std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
    match->inviteByUsername(username, [] (std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
  • Documentation coming soon.

Challenging

The creator of a match can issue challenges to other players by account id or username. A challenged player may not modify the match in any way. When the match is completed the result will be recorded as a ‘challenge_win’ or ‘challenge_loss’ on the challenged player’s profile.

  • match->challenge(accountId, [] (std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
    match->challengeByUsername(username, [] (std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
  • Coming soon.
  • Not supported.
  • Coming soon.
  • Documentation coming soon.

Joining

Once invited, you can call join on the match to join it.

  • AGPromise* p = [match join];
    [p when:^(AGRequest* request) {
        // ...
    }];
    
  • match.Join(delegate(Request request)
    {
        // ...
    });
    
  • match.join(new ResponseListener() {
        @Override
        public void responseReceived(Response r) {
            // ...
        }
    });
    
  • match->join([](std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
  • Documentation coming soon.

Leaving

Once in the match, or to decline an invitation, you can call leave on the match to leave it.

  • AGPromise* p = [match leave];
    [p when:^(AGRequest* request) {
        // ...
    }];
    
  • match.Leave(delegate(Request request)
    {
        // ...
    });
    
  • match.leave(new ResponseListener() {
        @Override
        public void responseReceived(Response r) {
            // ...
        }
    });
    
  • match->leave([](std::shared_ptr<Match> match, Request *request) {
        // ...
    });
    
  • Documentation coming soon.

Kicking

You are able to kick a player from the match, only the match owner or a server has the permission to kick a player. You can configure the notifications to the player being kicked separate from the rest of the players being notified.

Reference: C++ | REST

The Match Player Object

A match will have a list of all players associated with the match.

 {
   "players": [
     {
        "identity":{
           "username":"SomeUsername"
        },
        "state":"join",
        "account_id":"5102a78ae2c6625ed0000000",
     },
     {
        "identity":{
           "username":"AnotherUsername"
        },
        "state":"invite",
        "account_id":"5102abf8e2c6625ed000000a",
     }
   ]
}

Each player is made up of the following information:

identity :
This is the identity of the player already resolved for you. These are not stored on the match–they are resolved when you request the match, so if the user changes their username it will be correctly reflected.
state :

The state of the player.

join :
The player has joined the match.
invite :
The player has been invited to the match, but not yet joined.
left :
The player was in the match, but has left it.
account_id :
The account id for this player.
source :

Information about how the player joined the match. The source will have a type and an id field.

type: enum

  • Match for players that joined from another match.
  • Invite for players that were invited.
  • Matchmaking Fluid for players that came from a fluid matchmaking request.
  • Matchmaking Fixed for players that came from a fixed matchmaking request.

id:

  • If type is match, the id of the match that this player joined from.
  • If type is invite, the id of the account that invited this player.
  • If type is matchmaking fluid, the slug of the matchmaking criteria for the request.
  • If type is matchmaking fixed, an id identifying the fixed matchmaking result.

source match id: Only available if type is matchmaking fluid or fixed.

If the matchmaking request was done as a match, the match id. Otherwise, null.

request data: Only available if type is matchmaking fixed.

The request data, if any, that was sent along with the request for this player.

Notifications

You can configure notifications for your match type in the dashboard under the “Match messages...” section of the match type configuration page. Additional context around how to properly configure notifications can be found on the Notifications page.

There are several notifications you can subscribe to via events or listeners in each SDK. We additionally expose unhandled versions of these notifications that would only be triggered if there is no handler for the regular notification, or if the regular notification handler returns false. You can use the unhandled notifications to perform some base level action, and register for the regular notifications only when you are at a state that can do something more specific to that notification.

Match Invite

Triggered when a user has been invited to a match.

The object sent to the handlers contains:

Match :
The match that the logged in user was invited to.
Player :
The player that sent the invite.
Notification :
The notification text associated with the invite.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)invitedToMatch:(AGMatch*)match by:(AGMatchPlayer*)player notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    - (void)unhandledInvitedToMatch:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledInvited += Match_UnhandledInvited;
        // ...
    }
    
    void Match_UnhandledInvited(MatchInviteNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.Invited += Match_Invited;
        // ...
    }
    
    bool Match_Invited(MatchInviteNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean matchInvite(MatchInviteNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledMatchInvite(MatchInviteNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().Invited.add(handlerName, [](const MatchInviteNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledInvited.add(handlerName, [](const MatchInviteNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

Match Updated

Triggered when a match has been updated.

The object sent to the handlers contains:

Match :
The match that was updated.
Player :
The player that updated the match.
Notification :
The notification text associated with this update.
Data :
The data (if any) that was sent along with the update notification.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)matchUpdated:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    - (void)unhandledMatchUpdated:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledUpdated += Match_UnhandledUpdated;
        // ...
    }
    
    void Match_UnhandledUpdated(MatchUpdateNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.Updated += Match_Updated;
        // ...
    }
    
    bool Match_Updated(MatchUpdateNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean matchUpdated(MatchUpdateNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledMatchUpdated(MatchUpdateNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().Updated.add(handlerName, [](const MatchUpdateNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledUpdated.add(handlerName, [](const MatchUpdateNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

You can also subscribe to this notification via a Match object.

  • @interface MatchDelegate : NSObject <AGMatchDelegate>
    
    @end
    
    @implementation MatchDelegate
    
    - (BOOL)matchUpdated:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    // ...
    
    @end
    
    [match addMatchDelegate:matchDelegate];
    
  • {
        // ...
        match.Updated += match_Updated;
        // ...
    }
    
    bool match_Updated(MatchUpdateNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • match.addMatchListener(new Match.MatchListener() {
        @Override
        public boolean matchUpdated(MatchUpdateNotificationEvent event) {
            // ...
            return handled;
        }
    
        // ...
    });
    
  • match->Updated.add(handlerName, [](const MatchUpdateNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
  • Documentation coming soon.

Player Joined

Triggered when a player has joined a match.

The object sent to the handlers contains:

Match :
The match that triggered this event.
Player :
The player that triggered this event.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)playerJoinedMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
        return handled;
    }
    
    - (void)unhandledPlayerJoinedMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledPlayerJoined += Match_UnhandledPlayerJoined;
        // ...
    }
    
    void Match_UnhandledPlayerJoined(MatchPlayerNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.PlayerJoined += Match_PlayerJoined;
        // ...
    }
    
    bool Match_PlayerJoined(MatchPlayerNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean playerJoined(MatchPlayerNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledPlayerJoined(MatchPlayerNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().PlayerJoined.add(handlerName, [](const MatchPlayerNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledPlayerJoined.add(handlerName, [](const MatchPlayerNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

You can also subscribe to this notification via a Match object.

  • @interface MatchDelegate : NSObject <AGMatchDelegate>
    
    @end
    
    @implementation MatchDelegate
    
    - (BOOL) playerJoinedMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
        return handled;
    }
    
    // ...
    
    @end
    
    [match addMatchDelegate:matchDelegate];
    
  • {
        // ...
        match.PlayerJoined += match_PlayerJoined;
        // ...
    }
    
    bool match_PlayerJoined(MatchPlayerNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • match.addMatchListener(new Match.MatchListener() {
        @Override
        public boolean playerJoined(MatchPlayerNotificationEvent event) {
            // ...
            return handled;
        }
    
        // ...
    });
    
  • match->PlayerJoined.add(handlerName, [](const MatchPlayerNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
  • Documentation coming soon.

Player Left

Triggered when a player has left a match.

The object sent to the handlers contains:

Match :
The match that triggered this event.
Player :
The player that triggered this event.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)playerLeftMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
        return handled;
    }
    
    - (void)unhandledPlayerLeftMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledPlayerLeft += Match_UnhandledPlayerLeft;
        // ...
    }
    
    void Match_UnhandledPlayerLeft(MatchPlayerNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.PlayerLeft += Match_PlayerLeft;
        // ...
    }
    
    bool Match_PlayerLeft(MatchPlayerNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean playerLeft(MatchPlayerNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledPlayerLeft(MatchPlayerNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().PlayerLeft.add(handlerName, [](const MatchPlayerNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledPlayerLeft.add(handlerName, [](const MatchPlayerNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

You can also subscribe to this notification via a Match object.

  • @interface MatchDelegate : NSObject <AGMatchDelegate>
    
    @end
    
    @implementation MatchDelegate
    
    - (BOOL) playerLeftMatch:(AGMatch *)match player:(AGMatchPlayer *)player {
        // ...
        return handled;
    }
    
    // ...
    
    @end
    
    [match addMatchDelegate:matchDelegate];
    
  • {
        // ...
        match.PlayerLeft += match_PlayerLeft;
        // ...
    }
    
    bool match_PlayerLeft(MatchPlayerNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • match.addMatchListener(new Match.MatchListener() {
        @Override
        public boolean playerLeft(MatchPlayerNotificationEvent event) {
            // ...
            return handled;
        }
    
        // ...
    });
    
  • match->PlayerLeft.add(handlerName, [](const MatchPlayerNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
  • Documentation coming soon.

Match Completed

Triggered when a match has been completed.

The object sent to the handlers contains:

Match :
The match that was completed.
Player :
The player that completed the match.
Notification :
The notification text associated with this completion.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)matchCompleted:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    - (void)unhandledMatchCompleted:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledCompleted += Match_UnhandledCompleted;
        // ...
    }
    
    void Match_UnhandledCompleted(MatchCompleteNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.Completed += Match_Completed;
        // ...
    }
    
    bool Match_Completed(MatchCompleteNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean matchCompleted(MatchCompleteNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledMatchCompleted(MatchCompleteNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().Completed.add(handlerName, [](const MatchCompleteNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledCompleted.add(handlerName, [](const MatchCompleteNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

You can also subscribe to this notification via a Match object.

  • @interface MatchDelegate : NSObject <AGMatchDelegate>
    
    @end
    
    @implementation MatchDelegate
    
    - (BOOL) matchCompleted:(AGMatch *)match by:(AGMatchPlayer *)player notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    // ...
    
    @end
    
    [match addMatchDelegate:matchDelegate];
    
  • {
        // ...
        match.Completed += match_Completed;
        // ...
    }
    
    bool match_Completed(MatchCompleteNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • match.addMatchListener(new Match.MatchListener() {
        @Override
        public boolean matchCompleted(MatchCompleteNotificationEvent event) {
            // ...
            return handled;
        }
    
        // ...
    });
    
  • match->Completed.add(handlerName, [](const MatchCompleteNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
  • Documentation coming soon.

Match Expiration Warning

Triggered when an expiration warning interval (as defined in the match template) has been reached.

The object sent to the handlers contains:

Match :
The match that triggered this notice.
Notification :
The notification text for this notice.

You can subscribe to this notification via the Match Service.

  • @interface MatchServiceDelegate : NSObject <AGMatchServiceDelegate>
    
    @end
    
    @implementation MatchServiceDelegate
    
    - (BOOL)matchExpirationWarning:(AGMatch *)match notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    - (void)unhandledMatchExpirationWarning:(AGMatch *)match notification:(NSString *)notification {
        // ...
    }
    
    // ...
    
    @end
    
    [client.matchService addMatchServiceDelegate:matchServiceDelegate];
    
  • {
        // ...
        client.Match.UnhandledExpirationWarning += Match_UnhandledExpirationWarning;
        // ...
    }
    
    void Match_UnhandledExpirationWarning(MatchNoticeNotificationArgs args)
    {
        // ...
    }
    
    {
        // ...
        client.Match.ExpirationWarning += Match_ExpirationWarning;
        // ...
    }
    
    bool Match_ExpirationWarning(MatchNoticeNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • client.getMatchesService().addMatchListener(new MatchesService.MatchServiceListener() {
        @Override
        public boolean matchExpirationWarning(MatchNoticeNotificationEvent event) {
            // ...
            return handled;
        }
    
        @Override
        public void unhandledMatchExpirationWarning(MatchNoticeNotificationEvent event) {
            // ...
        }
    
        // ...
    });
    
  • client->getMatchService().ExpirationWarning.add(handlerName, [](const MatchNoticeNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
    client->getMatchService().UnhandledExpirationWarning.add(handlerName, [](const MatchNoticeNotificationArgs& args){
        // ...
    });
    
  • Documentation coming soon.

You can also subscribe to this notification via a Match object.

  • @interface MatchDelegate : NSObject <AGMatchDelegate>
    
    @end
    
    @implementation MatchDelegate
    
    - (BOOL) matchExpirationWarning:(AGMatch *)match notification:(NSString *)notification {
        // ...
        return handled;
    }
    
    // ...
    
    @end
    
    [match addMatchDelegate:matchDelegate];
    
  • {
        // ...
        match.ExpirationWarning += match_ExpirationWarning;
        // ...
    }
    
    bool match_ExpirationWarning(MatchNoticeNotificationArgs args)
    {
        // ...
        return handled;
    }
    
  • match.addMatchListener(new Match.MatchListener() {
        @Override
        public boolean matchExpirationWarning(MatchNoticeNotificationEvent event) {
            // ...
            return handled;
        }
    
        // ...
    });
    
  • match->ExpirationWarning.add(handlerName, [](const MatchNoticeNotificationArgs& args) -> bool {
        // ...
        return handled;
    });
    
  • Documentation coming soon.

Realtime

You can use our realtime features to send messages to players in a match.

Table Of Contents

Previous topic

Match Templates

Next topic

Matchmaking