Hi,
I’ve been trying to return the ip address of a dedicated server to matched users from MatchmakerMatchedFunction. I’ve tried to add it like this:
const onMatchmakerMatched : nkruntime.MatchmakerMatchedFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, matches: nkruntime.MatchmakerResult[]): string | void
{
// Create server instance at our hosting provider
let serverAddress : string = createAuthoritativeGameServer(logger, nk);
matches.forEach( match =>
{
match.properties["serverAddress"] = serverAddress;
logger.info("match property: " + match.properties["serverAddress"]);
});
}
The logging does log the correct address as expected, but the client doesn’t recieve the property when this event is triggered (in Unity):
private void OnMatchmakerMatched(IMatchmakerMatched matched)
I’ve noticed that when I set the properties earlier, it does work as expected:
const beforeMatchmakerAdd : nkruntime.RtBeforeHookFunction<nkruntime.EnvelopeMatchmakerAdd> = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, envelope: nkruntime.EnvelopeMatchmakerAdd) : nkruntime.EnvelopeMatchmakerAdd | void
{
envelope.matchmakerAdd.stringProperties = {"serverAddress" : "Not yet set" };
return envelope
}
But at this moment the address for the server is not known.
Is it possible to set properties from the MatchmakerMatchedFunction? If so, what am I doing wrong? Of not, how should I do this?
Thanks!