UNakamaRealtimeClient::PartyMatchmakerTicketReceived bug for non leader party members

  1. Versions: Nakama heroiclabs/nakama-enterprise:3.22.0-r3-mc, NakamaUnreal v2.10.0

I’ve bound a function to UNakamaRealtimeClient::PartyMatchmakerTicketReceived which gets triggered for all players in the party. However, only party leader has valid data, non party leader players get empty strings for both FNakamaPartyMatchmakerTicket::PartyId and FNakamaPartyMatchmakerTicket::Ticket.

I’ve tracked down the issue to the FNakamaPartyMatchmakerTicket::FNakamaPartyMatchmakerTicket(const FString& JsonString) constructor. Party leader and non leader members received different JSON data in here.

PartyMember = {"party_id": "812cdfa5-0b94-4a53-bc59-44d01901059b.nakama-0","ticket": "ee72e4b5-8472-4085-b7e5-e1231b99604d"}
PartyLeader = {"cid":"7", "party_matchmaker_ticket":{"party_id":"812cdfa5-0b94-4a53-bc59-44d01901059b.nakama-0", "ticket":"ee72e4b5-8472-4085-b7e5-e1231b99604d"}}

Since constructor checks for the existence of “party_matchmaker_ticket”, it’s failing to parse the data for non party leader members. Changing the constructor from

FNakamaPartyMatchmakerTicket::FNakamaPartyMatchmakerTicket(const FString& JsonString)
{
	TSharedPtr<FJsonObject> JsonObject;
	TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
	if (!FJsonSerializer::Deserialize(JsonReader, JsonObject))
	{
		return;
	}

	TSharedPtr<FJsonObject> PartyTicketObject = JsonObject->GetObjectField(TEXT("party_matchmaker_ticket"));
	if (!PartyTicketObject.IsValid())
	{
		return;
	}

	PartyTicketObject->TryGetStringField(TEXT("ticket"), Ticket);
	PartyTicketObject->TryGetStringField(TEXT("party_id"), PartyId);
}

to

FNakamaPartyMatchmakerTicket::FNakamaPartyMatchmakerTicket(const FString& JsonString)
{
	TSharedPtr<FJsonObject> JsonObject;
	TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
	if (!FJsonSerializer::Deserialize(JsonReader, JsonObject))
	{
		return;
	}
	
	if (JsonObject->HasField(TEXT("party_matchmaker_ticket")))
	{
		TSharedPtr<FJsonObject> PartyTicketObject = JsonObject->GetObjectField(TEXT("party_matchmaker_ticket"));
		if (!PartyTicketObject.IsValid())
		{
			return;
		}

		PartyTicketObject->TryGetStringField(TEXT("ticket"), Ticket);
		PartyTicketObject->TryGetStringField(TEXT("party_id"), PartyId);
	}

	else
	{
		JsonObject->TryGetStringField(TEXT("ticket"), Ticket);
		JsonObject->TryGetStringField(TEXT("party_id"), PartyId);
	}
}

apparently fixes the problem for me momentarily.

In addition to this, when party leader removes party from matchmaking, UNakamaRealtimeClient::PartyMatchmakerTicketReceived is not being triggered at all, neither on part leader nor the party members. Party leader gets the success or error callback from the UNakamaRealtimeClient->RemoveMatchmakerParty() function, which enables me to clear the matchmaking ticket to update my UI. However party members have no idea about leaving matchmaking.

I can’t see any LogNakamaUnreal log either on party members when party successfully leaves matchmaking, so I can’t track down the issue, if it’s me or client library related. I’d be happy to know if there is any built-in way to receive party matchmaking leave event from non leader party members.