BUG: OnStatusUpdate never fires.

Posted this in an old thread and decided to make new topic for visibility:
JohnTube wrote: »
I'm not sure but could you test that adding friends (chatClient.AddFriends) does not trigger an 'initial' OnStatusUpdate per friend?

I am not getting an initial status update on a friend after calling AddFriends. I need this to check if a user is offline before performing other game logic. I am testing this with a variety of friends, online and offline, editor and standalone build. I have tried implicitly and explicitly implementing the OnStatusUpdate callback from IChatClientListener. Nothing comes back, ever.

public string FriendToAdd;

public static void AddFriend()
    {
        var friend = new string[1] { FriendToAdd };
        _client.AddFriends(friend);
    }

public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
    {
        Debug.Log(string.Format("OnStatusUpdate:\r\nUser:{0}, Status:{1}, Msg:{2}, Message:{3}", user, status, gotMessage, message));
    }

Comments

  • JohnTube
    JohnTube mod
    edited August 10
    Hi @steamcore,

    Make sure Photon Chat client is connected.
    Make sure the implemented callbacks listener interface is used in the chat client.
    Make sure the friend has an explicit status (being connected does not mean the client has status online you need to do it explicitly) and the status is not offline or invisible.

    In C# SDKs there is a method: ConnectAndSetStatus as a shortcut.
  • steamcore
    steamcore ✭✭
    edited August 10
    Thanks for the reply @JohnTube

    Make sure Photon Chat client is connected.
    Done.

    Make sure the implemented callbacks listener interface is used in the chat client.
    Done.

    Make sure the friend has an explicit status (being connected does not mean the client has status online you need to do it explicitly) and the status is not offline or invisible.
    From the docs and your replies to other threads, I was under the impression you get an initial callback of OnStatusUpdate for every friend you add, regardless of if they've set their status. In other words, I'm expecting an "Offline" callback for everyone I add that is not online. Is this the case?
    Additionally, this is almost moot because I have already tried to test this with online and offline friends, those with whom I can send private messages (connection is tested) and no matter what state of connection and status setting I do on multiple clients, editor and in build, OnStatusUpdate never fires, ever.
  • I have experimented a bit more and found that if I use connectandsetstatus() that I receive the callback on that user, if they are online. I think that the replies and the documentation is a bit misleading because it seemed explicit that the callback fires initially on every AddFriends() call you make, regardless of whether the person you are adding is online or not. This would be a very effective online-test if it were the case. I can write a timeout on a coroutine to achieve the same thing, but it does seem like under the hood, a connection is being made to the other client and the callback fires from that, as opposed to a system-level check. It would be great if that were possible, because a timeout introduces the possibility for error.
  • Hi @steamcore,

    We will see if we can improve things at least the documentation part.
    Thanks for your feedback!