Not Invoked after a matchmaking

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…

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

Yes, Ue4 C++ Client

@sesposito Hey
Can you plz tell me about this?

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.

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’)
};