Handle Match found on server side

Hey there.

Is there a way to catch the MatchMakerMatched result on the server side in Lua, to run some logic when a opponent was found, for example to store an asynchronous match in the db without forcing the client to make another rpc call to the server, so that most of the things are handled by the server:

  1. client clicks on a button to find a match
  2. nakama matchmaker finds an opponent
  3. before sending the result to the client i want to run some code (is there a after hook to do such things)?
  4. result sent to the client as information about new created match only

thank you

There is the matchmaker matched hook.

If you’d like to run server code when the matchmaker has matched players together, register your function using the following.
nk.register_matchmaker_matched()

It is used for authoritative match.

i would not need it for authoritative match. only to run code after opponent found…does it work as well?

Yes you have to return nil for peer-to-peer relayed mode: reference

great thank you