question

Frank DiCola avatar image
Frank DiCola asked

Can a CloudScript call a function on a client?

In my app, players can sign up for quests that other players are offering.

When this happens, I want the Quest Giving players to refresh their data automatically so they can see that now they have someone signed up. (Other than showing an empty list)

Do I just need to have them constantly refreshing their data every 10 seconds to give the illusion of being "connected"? Or can my CloudScript tell a certain Player with a specific player ID that they need to run a function in Unity? (Assume that the player has their device open and the app is running) I can't find anything in the API on the Server level that looks like "send this player a message" or anything.

Trying to reduce unnecessary calls to the server, and I also don't want a manual refresh button.

Thanks for the help!

unity3dCloudScript
10 |1200

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

Seth Du avatar image
Seth Du answered

The quick answer is no, and Cloud Script cannot actively send notifications to clients since it is designed to be executed by the players.

If you can share more details about the scenario, we can possibly offer a work around solution, but for now from what I see, since Cloud Script can update any information in very few seconds, you can update Player Read-Only Data for both sides of the Quests and after the successful execution result is returned in clients, players can update their Player Data again to review the changes.

10 |1200

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

Frank DiCola avatar image
Frank DiCola answered

Thanks for the reply @SethDu ! This is for a real world charity volunteering app like Pokemon Go, but for actual non-profits and charities. The quests are service events - signing up for a quest is saying "I'll come volunteer at this time." I would like the charity to get an automatic alert when a player signs up.


So does that mean that the charity should just be constantly checking Player Read-Only Data every few seconds in Update (I'm using Unity) and keep pulling in new data? There's no more efficient way to do that? It seems wasteful, but if it works I'll just do that.

I hope in the future PlayFab lets you send a command from the server to a player to run a specific function or set a flag from false to true.

I'll try the auto-updates for now!

1 comment
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

You may also check the preview feature PlayFab Party, which may fit your requirement. You may access it automatically if you have subscription of Indie, Pro or Enterprise Tier. Otherwise, you can get a preview access code from your Microsoft developer partner manager.

It seems you need real-time network or chat like functions in your game. Please refer to: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/networking/

1 Like 1 ·

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.