Error for players r...
 
Notifications
Clear all

Error for players receiving friend request

12 Posts
3 Users
0 Reactions
1,001 Views
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

We've got a weird problem: PlayerX has sent friend requests to some other players, and when they click the Accept button, a popup appears saying Error Occurred. They close that, but it keeps popping up every 30-60 seconds (presumably our server ping period.) It just keeps doing that over and over, which obviously interferes with gameplay.

In phpMyAdmin, I've tried changing that friend request to Accepted, but it resets to Unaccepted. Then I tried deleting it, but: for one player, it somehow was regenerated--I could see it in phpMyAdmin again. For another player, it no longer appears in phpMyAdmin, but the error alert keeps appearing in the game. 

I've disabled the account of the player sending these friend requests, but that hasn't helped either. What else can I do? 

 
Posted : 24/02/2017 5:14 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Of course I cannot know your code, is it possible to have a Unity project with your current code where this behavior is reproduced? I've tried with the default demo scripts and it's not happening since of course the ping function has nothing to do with the contact's requests.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 24/02/2017 6:12 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

It's a huge project (25gb) so not easy to post it for you. We're not doing anything fancy with the friend request function anyways. Is there anything else I can try in phpMyAdmin to kill that friend request? Is that request normally (in basic Combu code) stored anywhere on the client side, which would regenerate it on the server after I delete it?

 
Posted : 24/02/2017 6:26 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Of course I'm not asking for your whole project, but only a sample project where you're able to reproduce eventually a bug.

The record of contacts and contact's requests are in CB_Friend for version 2.1.14 and earlier (IdAccount is the id of the owner account [the account who receives the request] and IdFriend is the account of the requesting/friend account, you have 2 records for both idaccount and idfriend with the Ids exchanged [one is in the list of the other one and viceversa]).

I think there's some code in your project that resets the request's state, anyway I'll do some checks in the server code as well and try to reproduce.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 24/02/2017 6:56 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

Hmm, okay, so the same friend request has two records, with each user in the ID Account field, right? I don't know that giving you a slimmed down project would be helpful, as this is an almost-unique problem -- I've gotten reports from three users in the past 24 hours, but all reporting friend requests from the same user (ID 4210). Here are screenshots for one such request -- and you can see that there is no record for a request between these two users, and yet user 43929 is still getting the friend error in the game. 

 
Posted : 24/02/2017 7:09 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

What is the code that you're using to get the requests? Sorry but if I cannot reproduce the problem it'll be very hard to find an issue 🙁

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 24/02/2017 7:18 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

We figured it out -- the user sending the friend request had some special characters in their username (probably from an emoticon): Lilly💗 and that apparently caused problems. After I changed that to plain ASCII, the problem disappeared. We can set up a new rule for username characters...but do you have any idea why this caused a problem, and what character set we can safely use? (We do have users in Russia and China so would like to allow a broad set of characters if possible.)

 
Posted : 24/02/2017 9:25 pm
(@tommih)
Posts: 44
Trusted Member
 

I'll clarify that a little:

There are two users: Lilly and LillyðŸ’. We thought it was Lilly sending the friend requests, and the table on the server showed friend requests from her to the recipients. However, on the recipient end, the friend requests appeared to be coming from LillyðŸ’. Meaning, when I requested the friend requests, the response contained LillyðŸ’'s record, with her user name and ID. Then, accepting that friend request failed with the ambiguous "An error occurred" from Combu.

We don't know which, if either, of those people actually sent friend requests.

 
Posted : 24/02/2017 10:10 pm
(@gecko64)
Posts: 82
Estimable Member
Topic starter
 

So I suppose the question is, did the emoticon itself cause the problem, or did the fact that we had two usernames that began with Lilly, and one had non-standard characters appended, and *that* is what confused Combu?

 
Posted : 24/02/2017 10:14 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

If you are using the overload of the method User.AddContact (and RemoveContact) that accepts the username as input parameter then I'd suggest to turn it to the other one that accepts a Profile object as parameter, because the latter sends the user's Id instead of username (which maybe is causing your issue, perhaps for wrong escaped string from WWWForm) so it should never confuse. Usually the rule for usernames should be to accept only alphanumeric characters, so we never really experienced this issue, anyway we will do some tests with other UTF8 characters too (though emoticons or any other non-alphanumeric characters should be really avoided from usernames).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 24/02/2017 10:59 pm
(@tommih)
Posts: 44
Trusted Member
 

Thanks for the response!

That sounds like it could help. However, I'm not sure where to get the Profile object. There are two situations in which I use AddContact(userName etc):

1) When sending a friend request. We use the user name because the players add friends simply by typing out the name of the friend they want to add. I don't know how I could use a profile object instead.

2) When accepting a friend request. Here I imagine I could somehow use a Profile object, but the objects given by CombuManager.localUser.requests are of type IUserProfile (which is the interface of Profile). Is it safe to just cast this is a Profile and use it or do I need to do something else?

 
Posted : 25/02/2017 7:17 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

TommiH said
1) When sending a friend request. We use the user name because the players add friends simply by typing out the name of the friend they want to add. I don't know how I could use a profile object instead.

Instead of sending the username and wait for an error (in case the user doesn't exist), you could use User.Load to see if the username exists and then pass the profile to AddContact:

User.Load("myfriend", (User user) => {
   if (user == null)
   {
      Debug.Log("User doesn't exist!");
   }
   else
   {
      CombuManager.localUser.AddContact(user, eContactType.Friend, (bool successContact, string errorContact) => {
         Debug.Log("Added contact: " + successContact + " -- " + errorContact);
      });
   }
});

This way you will never have issues with any username. Though this could lead to the issue with username's characters if you're allowing non ASCII code in username (that you should really avoid, instead you could allow only ASCII as username and then add a customData "displayName" to be displayed in your UI).

But are you sure that the problem is in Combu and not in the UI Text (or any other UI framework used)?

In the version Combu 3.0 beta we're sending all data as JSON-encoded, so there's no issues when I use Debug.Log() on usernames with non-ASCII characters, it correctly prints both Lilly💠and Lilly (but again it could be an issue with the UI framework that is not correctly printing the non-ASCII, anyway it seems that the official Demo scene is not having any issue by using Unity UI Text and it's printing all characters correctly).

TommiH said
2) When accepting a friend request. Here I imagine I could somehow use a Profile object, but the objects given by CombuManager.localUser.requests are of type IUserProfile (which is the interface of Profile). Is it safe to just cast this is a Profile and use it or do I need to do something else?  

Yes you can safely cast IUserProfile to Profile and/or User if the data is coming from Combu web services. The reason why some callbacks return IUserProfile instead of Profile/User is usually because they're an extension of Unity SocialPlatform classes/interfaces.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 25/02/2017 8:18 pm
Share: