Socket.ReceivedPartyData Event is not firing off on the Client


  1. Versions: Nakama {3.11.0}, {Docker}, {Unity SDK 3.3.0}
  2. Server Framework Runtime language {TS/JS}


I am trying to send party data when a user takes an action from the Client to the other Clients in the same party. However, the RecevedPartyData is not triggering once I send the action to the party.

I am using the function Socket.ReceivedPartyData, which looks like this:

var updateJson = "{\"test\": \"a test string\"}";
await gameConnection.Socket.SendPartyDataAsync(gameConnection.CurrentParty.Id,
                1, updateJson);

and I am listening for the event on the Socket connection:

_gameConnection.Socket.ReceivedPartyData += ReceivedPartyData;

// defined elsewhere...
private void ReceivedPartyData(IPartyData partyData)
        Debug.Log($"ReceivedPartyData: {partyData}");      
        switch (partyData.OpCode)
            // ... do different things based on OpCode

However, I never see this Debug.Log($"ReceivedPartyData: {partyData}") in the logs.

I see in the server logs that this is sent:

27T07:38:49.601Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_PartyDataSend message","uid":"abe0bf47-390a-43d2-aa56-df077ecce914","sid":"44fb6ab7-c5fc-11ec-a748-006100a0eb06","message":{"PartyDataSend":{"party_id":"2252411c-015c-46bd-b5f3-6308bcf453b6.nakama","op_code":1,"data":"eyJ1bWFTdHJpbmciOiJBQSp8UjpDaGliaUhlcm9HaXJsfFc6U2hvcnRIYWlyX1JlY2lwZSxHaXJsLk91dGZpdDAxX1JlY2lwZSx8QzpIYWlyLDM9MCxGRjhBMDAyRTt8QzpFeWVzLDM9MCxGRjQ4Q0JENjt8QzpTa2luLDM9MCxGRjk1NEU4RTt8QzpQYW50czEsMz0wLEZGNUE2QUEzO3xDOlRlZXRoQ2xhd3MsMz0wLEZGRkZGQUQzO3xDOklubmVyTW91dGgsMz0wLEZGOUIxOTE5O3xDOldlcmV3b2xmU2tpbiwzPTAsRkY1MjQwMTg7fEM6V2VyZXdvbGZFeWVzLDM9MCxGRkZGRjdENTt8RDp8In0="}}}

but my Unity Client does not hit the break point in ReceivedPartyData.

What could be wrong?

Any help is appreciated :slight_smile:

Thank you!

Hi @lighting,

The code snippets you shared look correct. Could you tell me a little bit more about how you are testing party data sending? For example:

  • are you testing on one client or with multiple clients?
  • can you confirm that the client(s) is(are) in the party that the data is being sent to by comparing the party ids?

Any more details about what setup you did before this would be useful for us to help solve your issue.

Kind regards,

Hi @sean!

Thank you for your reply.

What I was doing for testing was creating a party with a single party member and attempting to send the data to that single party member.
Your message triggered a thought that sending party data does not send the message to the initiator.

Does the sender of the data not get the message? Is there a way for the sender to also receive the message if this is the case? haha

Thank you for your time! I really appreciate it :smile:

Hi @lightning,

The client calling Socket.SendPartyDataAsync does not get a copy of the data. The design follows the typical socket broadcast model which sends the data to others and does not duplicate it to the sending client.

The same applies for Chats and Matches, although they do have the ability to send to specific players so you could send it to yourself.

I’d recommend immediately making use of the Party data you want to send as this would make the experience smoother for the player initiating the event. For example, the player clicks a button, it sends a message to the party, and they can see the immediate result instead of having to wait for a network message.

I hope that helps.

1 Like

Yes, that does help. :slight_smile:
And that’s totally fine now that I understand.

Thank you :smile:

1 Like