Does FindFriends only work when not in a room?

Options
I have FindFriends working when I am not in a room, and I call it periodically to get the online status of friends. Works fine before I join a room.

However when I create/join a private (IsVisible = false) room, it doesn't work anymore. I would like to invite friends to the private room once I'm already in it. I get these two errors instead:

Operation failed: OperationResponse 222: ReturnCode: -2 (Unknown operation code). Parameters: {} Server: GameServer
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1544)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

FindFriends failed to apply the result, as a required value wasn't provided or the friend list length differed from result.
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1922)

In NetworkingPeer line 1906, both lists are empty:
i.e. onlineList and roomList are both null.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @aravikumar,

    Thank you for choosing Photon!

    Yes FindFriends should work on Master Server only (when not joined to a room).
  • aravikumar
    Options
    It's good to know the reason it was failing, thanks!

    Is there a way around this, or other suggestions you might have to know which friends are online once I'm in a room?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Is there a way around this, or other suggestions you might have to know which friends are online once I'm in a room?

    - You need to have a separate client to do this or
    - use an external service (HTTP/web based maybe combined with WebRPC) to track friends availability or
    - use Photon chat.
  • aravikumar
    Options
    I switched my friend management to PhotonChat and it works much better. Thanks!
  • xblade724
    xblade724
    edited June 2017
    Options
    Sorry to bump, but totally relevant -- why is it again that we can't update friends while in a room? A once/min refresh doesn't sound too burdening compared to other Photon funcs.

    It's bizarre that a friend gets into a queue of the game, tell his buddy to get on, and never see him get on because of this ~

    Logically, it makes no sense to me, so it must be a functionality problem?
  • Guy
    Options
    Hi, @JohnTube I am not sure why I can't find friends when I am in a room. Does it mean that every time I want to add a friend I need to exit from the room?
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2020
    Options
    Hi @Guy,

    Thank you for choosing Photon!
    I am not sure why I can't find friends when I am in a room.
    FindFriends works only outside rooms.
    That is by design.
    Does it mean that every time I want to add a friend I need to exit from the room?
    Yes if you want to use a singe Photon Realtime client or PhotonNetwork only. Other options include using friends system based on Photon Chat OR having a separate distinct LoadBalancingClient that remains connected to Master Server (not joined to rooms) to do operations that are only allowed outside of rooms like FindFriends. Having to maintain two Photon Realtime clients (PhotonNetwork + LoadBalancingClient) is not something we recommend (or give support for) and you need to keep in mind that both options mean either separate AppId / plan or double CCU.
    You could also use an external service for friends management like PlayFab or facebook after all Photon does not persist friends lists or pending requests.