on resuming app, my online status (from FriendList) is not propagated to other devices
Options
I'm on 1.60 PUN+ (iOS)
I'm seeing some strange behaviour. I'm using facebook authentication and I have player A and player B both connected. Player A can see B. B disconnects (turns off device). A sees that B is now offline. B reconnects (turns back on device). A still sees B offline, but B can see A :S.
We are refreshing every ~10 seconds and after waiting for several refreshes, it never updated.
We confirm that player is in lobby (status is JoinedLobby state)
I'm seeing some strange behaviour. I'm using facebook authentication and I have player A and player B both connected. Player A can see B. B disconnects (turns off device). A sees that B is now offline. B reconnects (turns back on device). A still sees B offline, but B can see A :S.
We are refreshing every ~10 seconds and after waiting for several refreshes, it never updated.
We confirm that player is in lobby (status is JoinedLobby state)
0
Comments
-
Note that we tried reverting the plugin to a previous version of PUN (1.53), and this problem does not occur on 1.53.0
-
We are also encountering a situation where the IsInRoom remains true when it is not the case. The scenario is as follows; Player A opens room, send room ID to Player B, Player B joins room whilst Player A leaves room. Player A room is in fact null and status is JoinedLobby. However when Player B leaves room and checks the friends status for Player A, it says that IsInRoom is true. We double checked that the FetchFriends() method is being called. This issue is present in both 1.53 and 1.60
-
Do you assign a UserId per player?
FindFriends works best, if you use a unique ID per user. Then you can actually find your friend and not someone who happens to have the same NickName.
You don't need a authentication service. For testing, just make sure each client has a a UserId set before you connect by setting: PhotonNetwork.AuthValues
If you continue to have the issue, I will check early next week (about to start the weekend now).0 -
This is how we are connecting
// Player name is equal to Facebook ID after authentication
var authValues = new AuthenticationValues();
authValues.AuthType = CustomAuthenticationType.Facebook;
authValues.AddAuthParameter(FB.UserId, FB.AccessToken);
// Must set PhotonNetwork.playerName to FB.UserId to be able to detect when a player is online
AVDebug.Log("Registering player name - " + FB.UserId);
PhotonNetwork.playerName = FB.UserId;
// The callback method 'OnJoinedLobby' is called if PhotonNetwork.autoJoinLobby = true (default)
PhotonNetwork.ConnectUsingSettings("1.0");
We also tried doing the updated way (authValues.UserId = FB.UserId), but we still saw the same problem.
0 -
You should use the new PUN version. The last code sample in paragraph "Implementation of custom authentication" will show you how to set username and token for FB.
The UserId is for Photon, while AddAuthParameter sets values for Facebook.
If your UserId for "B" is the same for the first and second connect, "A" should see that.
0 -
The code snippet in your documentation is missing this:
PhotonNetwork.AuthValues.UserId = FB.UserId;0 -
Good point! True. I'll add that.
There is a new option that allows the Custom Authentication server to set the UserId. So in theory, this is not a must-have anymore. But we have to explain that in detail, first.
Thanks0 -
We are also noticing that certain times, the IsInRoom status is not being updated. We are sending 'game invites' by creating a room with both player IDs and a random string. Players monitor the room list for their own IDs and when a new room with their ID is available it means that there was a request for them. Having said that the scenario to reproduce our problem is as follows;
Player A creates room
Player B monitors room list
Player B detects room with his ID and tries to join room
Player A immediately leaves room
From Player B point of view, Player A IsInRoom remains to true (when in fact it is not, as the PhotonNetwork.room is null and the PhotonNetwork.connectedAndReady is true for Player A). Please note that we also double checked that the FindFriends is running on both Player A and Player B
In this state, Player B can't send an invite to Player A (as we are setting those players with IsInRoom == true as not available for invites). On the other hand, Player A sees Player B as online and available for invites (which is correct) and as soon as Player A creates a room, Player B sees Player A as online and available. Once the room is created, Player B receives the invite and the game continues normally.
Is there anything we are missing here? Can we force a refresh so that Player A IsInRoom is updated properly?
Thanks,
Clayton0 -
anyone?0
-
IsInRoom is part of the info about friends.
The friend info is not updated automatically. Clients have to poll the list of their friends, if they need an update. In best case, clients fetch this list infrequently and only when they can make use of the data.
It might take a moment, until the master server gets the update of someone leaving. It takes extra long (8 seconds and more), if the client times out (not leaving correctly, closed, etc).
So: even if the state of a friend changes, it's not auto-updated on B's screen.
Did you allow some time for the update to distribute and did you update the friend list?
What was your timing, approximately?
0 -
Could we inquire as to whether there was an interruption of service last night at around 10:45pm to 11:10pm Eastern? We encountered an infinite load (game did not hang) when trying to query for a list of friends and their status.0
-
Hi @Tobias ,
We keep fetching friend status every 5 seconds. And in the case mentioned by Clayton, even if we leave it for a minute it will not update. But as soon as something happens (e.g. A friend creates a room), the friend list gets updated.
(As regards to rtzong's question, he's our QA lead and I told him to post his query in this forum thread as it seemed somehow related with the friends list.)0 -
Hello rtzong,
there was no known issue on our side last night.0 -
The friend list is only available on the Master Server. If B is in the room, it can't get an update of the find friends.
Is B going back to the lobby to refresh the friends list? An error gets logged, if B doesn't.
Do you now set AuthenticationValues.UserId before connect?
How often can you reproduce this?
I can't0