How to add a single friend or remove a single friend

Hi guys,

I use Photon Chat. I use chatClient.AddFriends( friendNamesArray ) to add the list of friends for which I want to get the online status. I have a feature that allows you to add a friend (or remove a friend). The friend list is stored by the app. Is there a way I can add a single friend to Photon or do I need to:

chatClient.RemoveFriends( oldFriendNamesArray ) and then do chatClient.AddFriends( newFriendNamesArrayWithOneMoreFriend ) or will photon add the diff between the first list and the new list by just calling chatClient.AddFriends( newFriendNamesArrayWithOneMoreFriend )?



  • Hello,

    As far as i can tell, PhotonChat uses array and not List.
    That mean it will be reassigned every time.

    So if you do
    chatClient.AddFriends( list of 3 friends );
    chatClient.AddFriends( list of 2 friends );

    Should be a list of 2 friends.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2017
    Hi @Koran, @Jay_mt,

    Add or Remove friends methods update the friends list on the server side and do not override it each time. So if you can safely add one or remove one as follows:
    chatClient.AddFriends(new string[1] {friendUserId});
    chatClient.RemoveFriends(new string[1] {friendUserId});