# Not Invoked after a matchmaking

**URL:** <https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444>\
**Category:** Runtime Framework\
**Tags:** server-framework, matches\
**Created:** [March 9, 2022, 7:16am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444 "2022-03-09T07:16:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Looper](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@Looper](https://forum.heroiclabs.com/u/Looper)\
**Post date:** [March 9, 2022, 7:16am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/1 "2022-03-09T07:16:05Z")

</div>

initializer.registerMatchmakerMatched(matchmakerMatched);  
initializer.registerMatch(‘lobby’, {  
matchInit,  
matchJoinAttempt,  
matchJoin,  
matchLoop,  
matchLeave,  
matchTerminate,  
matchSignal  
});

const matchmakerMatched: nkruntime.MatchmakerMatchedFunction = function (ctx: nkruntime.Context, logger:nkruntime.Logger, nk:nkruntime.Nakama, matchedUsers: nkruntime.MatchmakerResult)  
{  
matchedUsers.forEach((u) =\>{  
logger.info(u.presence.userId);  
logger.info(u.presence.sessionId);  
logger.info(u.presence.username);  
logger.info(u.presence.node);  
logger.info(u.properties.mode);  
logger.info(JSON.stringify(u.properties));  
});  
return nk.matchCreate(‘lobby’,{debug:true,expectedUsers: matchedUsers});  
};

How can I implement a function which is invoked after a matchmaking request is complete? I used onMatchmakerMatched but it isn’t invoked after the matchmaker request has been fulfilled…

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 9, 2022, 11:31am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/2 "2022-03-09T11:31:00Z")

</div>

Can you please share the code you’re using for matchmaking?

---

<div class="post-metadata">

**Author:** ![Looper](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@Looper](https://forum.heroiclabs.com/u/Looper)\
**Post date:** [March 9, 2022, 11:40am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/3 "2022-03-09T11:40:52Z")

</div>

Yes, Ue4 C++ Client

 ![Screenshot 2022-03-09 171007](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/9/9de460b117e54285051f79929cbb3b0a9d12bd3a.png)

---

<div class="post-metadata">

**Author:** ![Looper](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@Looper](https://forum.heroiclabs.com/u/Looper)\
**Post date:** [March 10, 2022, 6:35am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/4 "2022-03-10T06:35:53Z")

</div>

@sesposito Hey  
Can you plz tell me about this?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 11, 2022, 11:46am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/5 "2022-03-11T11:46:11Z")

</div>

There are two possible issues, either you’re loading the Lua provided example modules in the `data/modules` folder, which will cause the `matchmakerMatched` hook in Lua to take precedence over your JS defined one and will be invoked instead, or your hook is failing because the JS code above is incorrect, this line: `logger.info(u.properties.mode);` will likely fail if `u.properties.mode` is not a string, this would’ve output an error in the server logs.

---

<div class="post-metadata">

**Author:** ![Looper](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@Looper](https://forum.heroiclabs.com/u/Looper)\
**Post date:** [March 15, 2022, 8:28am UTC](https://forum.heroiclabs.com/t/not-invoked-after-a-matchmaking/2444/6 "2022-03-15T08:28:42Z")

</div>

I got the solution. Now the matchmaker Hook is worked,  
I am ignored the codes like MatchInit,matchjoinAttempt,matchJoin …  
Now,

initializer.registerMatchmakerMatched(matchmakerMatched);  
initializer.registerRpc(“getServerIp”, getServerIp);

const matchmakerMatched: nkruntime.MatchmakerMatchedFunction = (  
ctx: nkruntime.Context,  
logger: nkruntime.Logger,  
nk: nkruntime.Nakama,  
matchedUsers: nkruntime.MatchmakerResult  
): string | void =\> {  
logger.info(‘Matchmaking succesful’);  
logger.info(`Matched players ${matchedUsers[0].presence.username} & ${matchedUsers[1].presence.username}`);  
return nk.matchCreate(‘getServerIp’)  
};
