Hello, I am working on 2 way confirmation friend request and I have a dilemma... this is my cloud function:
handlers.SendFriendRequest = function(args, context) { var player1Id = currentPlayerId; var player2Id = null; if (args && args.friendId) player2Id = args.friendId; // Make Player 2 a Friend of Player 1 var request = { PlayFabId: player1Id, FriendPlayFabId: player2Id, }; var result = server.AddFriend(request); // Make Player 2 a Friend of Player 1 // Make Player 1 a Friend of Player 2 request = { PlayFabId: player2Id, FriendPlayFabId: player1Id, }; result = server.AddFriend(request); // Make Player 1 a Friend of Player 2 }
So right now it should only make the add friend mutual.(So both players are friends with the other)
The problem is the cloud callback function gets called when the cloud runs this function. But I want to wait until the cloud script has called the function and the friends have been added before the call back is called.
So in short how can I wait till a server api call has been made before sending cloud callback.? Thanks!