How To Become A Matchmaking Host

With MatchMaker client class, hosting a matchmaking is made simple.

When you host matchmaking, you will be able to wait for other user clients to find your matchmaking and join.

The host and other matched user clients will receive a notification every time a new user client matches and joins/leaves the matchmaking.

What You Can Do As A Host

Here is the list of actions you may take as a matchmaking host:

  • Clear (abort) your matchmaking and notify all matched (joined) user clients.

  • Send custom messages to matched (joined) user clients.

  • Notify matched (joined) user clients of matchmaking completion. The host may decide when to send this out otherwise the server will automatically notify all user clients when the matchmaking reaches its member limit.

  • Synchronize client addresses of all user clients for Diarkis P2P (peer-to-peer).

Hosting A Matchmaking

NOTE: The example below assumes there is a matchmaking profile called RankMatch defined on the server.

Diarkis.Modules.MatchMaker mm = new Diarkis.Modules.MatchMaker();

// Specify which matchmaking profile to use for your matchmaking
mm.MatchmakingProfileID = "RankMatch";

// Define how many user clients allowed to join your matchmaking
mm.MaxMatchMembers = 8;

// Unique ID to identify your matchmaking i.e. your user ID etc.
mm.UID = "Set some unique ID to identify your matchmaking";

// Matchmaking condition properties
Dictionary<string, int> properties = new Dictionary<string, int>();
properties.Add("rank", 10);

mm.Properties = properties;

// Set this to true, if you wish to start multiple matchmakings without joining yourself
mm.ReverseOnly = false;

// Start hosting your matchmaking

Matchmaking Host Events

When you execute HostMatchmaking, the server sends a response to indicate if the operation was successful or not.

// Server response for HostMatchmaking
// that tells you if becoming a host has failed or not
mm.OnHostResponse += (bool success, string matchmakingRoomID, byte[] response) =>


Event Raised When A new Match Joins

When a new matched user client joins, all matched (and joined) user clients will raise the OnMemberJoin event.

mm.OnMemberJoin += (byte[] message) =>
  // Message byte array data from the newly matched user client

Event Raised When A Match Leaves

When a matched user client leaves, all matched (and joined) user clients will raise the OnMemberLeave event.

mm.OnMemberLeave += (byte[] message) =>
  // Message byte array data from the user client that has left

Event Raised When A Match Sends A Synchronizing Message

All matched (and joined) user clients may freely send messages to other matched user clients.

mm.OnMemberSync += (byte[] message) =>


Event Raised When The Matchmaking is Completed

When the matchmaking reaches is MaxMatchMembers, the server raises the OnComplete event on all matched (and joined) user clients.

The host may freely trigger OnComplete as well.

mm.OnComplete += () =>


Event Raised When Client Addresses For P2P Is Synchronized

All matched (and joined) user clients may synchronize client addresses to start P2P.




mm.OnP2PAddressSync += (string[] addressList) => {
  // The list of all matched and joined user clients' client addresses.
  // The format of the address string is "".

Clear (Abort) The Matchmaking

You may abort your current matchmaking as a host. Clearing the matchmaking does NOT disband the matchmaking and the matched users remain with the matchmaking.

Clearing the matchmaking will make it ONLY remove itself from matchmaking searches.


Receive Server Response

mm.OnAbortMatchmakingResponse += (bool success, byte[] payload) =>


Disbanding The Matchmaking

You may disband the matchmaking. By disbanding the matchmaking, you will be destroying the matchmaking completely and all matched users will be removed from the matchmaking.

byte[] message = Encoding.UTF8.GetBytes("This message will be delivered to all matched user clients.");


Receive Notification For Matchmaking Disbandment

mm.OnDisbandMatchmaking += (byte[] message) => {


Last updated