question

achatterjee avatar image
achatterjee asked

Is there a way to Send Data between Clients ?

I would like to know if it is possible to send data between clients using PlayFab, if the only thing the sending client has is the receiving clients EntityKey ? This needs to be done without using Party or Groups.

Player DataTitle DataShared Group Datadata
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Ivan Cai avatar image
Ivan Cai answered

Sending data directly between clients is not supported by playfab, and it needs to go through the server side. Now that you have the EntityKey of the receiving client, you can call the SetObjects API in cloudscript to store the data into its objects and retrieve them later using GetObjects.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

achatterjee avatar image achatterjee commented ·

@Ivan Cai

Would you mind expanding on SetObjects API in clouldScript ?
Which object to set ? The "title_player_account" entity's objects ?

0 Likes 0 ·
Ivan Cai avatar image Ivan Cai ♦ achatterjee commented ·

The objects to set are the "title_player_account" entity's objects.

An example of expanding on the SetObjects API in cloudscript is as follows:

handlers.callEntityAPI=function(args,context){

    entity.SetObjects({

         Entity:

         {

          Id: args.ReceiverEntityId,

          Type: "title_player_account",

          TypeString: "title_player_account"

          },

         Objects: [

            {
                ObjectName: "obj",

                DataObject: args.customData

            }

        ]

    })

}

At this point, the customData passed in by the client is:

"Key": "Data"

The figure below shows the Receiver client entity's objects:

1 Like 1 ·
answer14.png (5.4 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.