Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Reid Taylor · May 23, 2021 at 11:07 PM · Player DatadataFriends

Friends and chat

Hello, we are working on a mobile multiplayer game. We use PlayFab for accounts and save data, Photon for rooms and general networking gameplay, and Unity as our game engine. In our game it is very important to have friends. I have worked tirelessly on this issue... First we needed friend request so I figured out this (very difficult) system for request confirmation. At the end this was no help what so ever because we need more... We want to be able to send friend request and the requested player instantly (obvious delay) receives the request and can accept it. Then once friends, they should be able to chat, invite to a team party, etc... This all is surrounded by a specific problem. PlayFab allows no way (that I or any help I've been given know of) to send data to a player that receives a callback when they receive it. I have tried using cloud script and have found no way. Please help or give any useful information you have. Thanks!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by SethDu · May 24, 2021 at 06:11 AM

For a private chat, we usually suggest using Shared Group Data to store logs and it can be handled by Cloud Script/Azure Function, while SendPushNotification API can be called there to inform the another player. This solution can be applied to a small group, but is not recommended when there is a large group because concurrent data writing error can occur.

A better solution is to use the new feature PlayFab Party, please refer to: Azure PlayFab Party overview - PlayFab | Microsoft Docs. In addition, since you are using Photon, using Photon chat is also feasible.

In terms of friend request, it can be done via Cloud Script/Azure function. Here is some tips:

  • Disable AddFriend client API via editing API policy
  • Implement a “SendFriendReuqest” function. Each player will have 1 KVP in Player Read-Only Data – “Sent Request” and “Received Request”.
  • When Player A call this function to send friend request for Player B. the Request log will be stored in Player A’s “Sent Request” and Player B’s “Received Request”.
  • If the request already exists in Player B’s “Sent Request”, they will be friend immediately, the request log will be removed then.
  • Player B will be able to Approve or Decline the request, which is another Cloud Script function. When approved, simply remove the log in “Sent Request” and “Received Request” of both players. While when declined, remove the request of both sides.
Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Reid Taylor · May 24, 2021 at 09:59 PM 0
Share

@SethDuThanks for your response! First of all I need to clarify that we are using the free version of PlayFab (which to my knowledge does not support PlayFab multiplayer). And about the friend requests this is exactly what I did... The problem is that it is not realtime. So when a friend request is sent there is no way to have something happen realtime on the requested players screen because there is no realtime callback feature. Am I missing something?

avatar image SethDu ♦ Reid Taylor · May 25, 2021 at 02:09 AM 0
Share

It is not supported due to the Restful API nature of PlayFab. As a workaround, you may send push notification when player approves or declines the request, while the client can force a refresh when the player clicks the notification. Otherwise, the client should refresh the data in a specific interval and updates the latest request list every time they open that panel.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    How to handle winning and rewarding in a game? 1 Answer

    Hi! I login to the game with my PlayFab username. After I'm entering a room created by Photon. My purose; When I enter the room, I want to see me and other users PlayFab Username or display name. What should I do? 1 Answer

    Saving Player Data 2 Answers

    Friends List Display Name 2 Answers

    Is it possible to get all player data for specific title? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges