In the Unity Asset Store, Combu now requires Unity 5.3. Our project is stuck on 4.7, but I assume that's not a problem, right? (I can download it from your store here to bypass that.)
Hopefully the core API doesn't use specific Unity version stuff or anyway it should be around precompiler #if.
FRANCESCO CROCETTI @ SKARED CREATIONS
Thanks. One other question. Are there any concerns about upgrade timing? We have a lot of players playing the game with combu 2.1.2. If we upgrade the server with 2.2.1 files, will that cause any problems for them?
I think it shouldn't be an issue, though just try to run the client with older version against a server with newer version.
FRANCESCO CROCETTI @ SKARED CREATIONS
We thought that 2.2.1 fixed the issue with Online Status, but now it seems that it did not. We really need to get this working. Can we do anything to help you debug it?
EDIT: I just did a quick test with another player. We're in the same time zone, and when she ran the game, her Online Status indicator changed to "On" -- but after a couple minutes, it changed back to "off" even though she was still in the game, and even sent me a message via Combu. So I know this online status system can't be perfect, but this is not really working decently at all. Players *really* want it to work.
Since HTTP is a connectionless protocol, there's no way you can have a realtime "online status", so the trick we're using is to store the UTC date/time every time you call a webservice after login and check it back in Unity against the CombuManager.instance.onlineSeconds (in Profile.state property). Also consider that you need to refresh the User data (through Load method) in order to get latest date/time action of that player, since of course the changes are not spread by server itself (for the same reason of HTTP being connectionless, so you need to pull data in order to get latest changes to the database).
FRANCESCO CROCETTI @ SKARED CREATIONS
What does Combu use to determine if a player has gone offline or is still online? What does "lastSeen" mean exactly? One would think that being logged in would be enough, but does it also require the client to send some kind of messages to the Combu server? We tend to update our friends lists every frew minutes, but maybe that's too long and it times out?
gecko64 said
What does Combu use to determine if a player has gone offline or is still online? What does "lastSeen" mean exactly? One would think that being logged in would be enough, but does it also require the client to send some kind of messages to the Combu server? We tend to update our friends lists every frew minutes, but maybe that's too long and it times out?
lastSeen is the date/time of the latest action done by a user (that is the latest call to any webservice). So theoretically if you've set pingIntervalSeconds in your CombuManager component then you should be fine since it will call the ping webservice every X seconds, and doing so it updates the lastSeen property.
Please download and try this on the just released version 2.1.13 (check Changelog.txt in Unity, you'll need to update both server and client, please make a backup of your current web&client files) and let us known if that solves your issues.
PS: of course if your "friends" refreshing interval is greater than onlineSeconds of your CombuManager component, then you'll have some time in between when the friends appear offline. To avoid this, you should set the refreshing interval lower than onlineSeconds (e.g.: if onlineSeconds=120 then your friends refreshing interval could be 60). onlineSeconds is the number of seconds between lastSeen and Now (UTC) to be considered as online.
FRANCESCO CROCETTI @ SKARED CREATIONS
We only update the online indicator when we update the friends list, so that end is under control. However, if the friend is playing the game and thus only sending messages to Combu every 90 seconds, maybe that's too long? Though testing the onlineSeconds variable, it seems to default to 120 seconds, and the client is supposed to check the Combu server at least every 90 seconds...
We'll update to 2.1.13. Do we need to update the sql file? I'm leery of doing that since we have a lot of accounts in that db.
No changes to database, only to web&Unity files. But I'd suggest to install this update in a temp folder in order to not break the production app, and test it in a dev environment.
FRANCESCO CROCETTI @ SKARED CREATIONS
I'm sorry but I still can't get the online status to work. It seems it registers you as being online as you log in, and sets the lastSeen variable to the time of login, but afterwards nothing affects that time. I just tested by printing out the CombuManager.localUser.lastSeen value every 20s, right after polling the friends list each time. I've also set the pining interval to 60s, so either the ping or the friends list polling should have advanced the lastSeen time, correct?
TommiH said
I'm sorry but I still can't get the online status to work. It seems it registers you as being online as you log in, and sets the lastSeen variable to the time of login, but afterwards nothing affects that time. I just tested by printing out the CombuManager.localUser.lastSeen value every 20s, right after polling the friends list each time. I've also set the pining interval to 60s, so either the ping or the friends list polling should have advanced the lastSeen time, correct?
localUser.lastSeen is updated only by CombuManager.Ping (and so also AutoPing if you've set Ping Interval Seconds in your CombuManager inspector), I mean that every call to any webservice updates the "last seen" field in the database (but of course you still need to reload localUser manually in Unity, either with localUser.Load or by setting a ping interval or by calling CombuManager.instance.Ping).
I have attached a demo scene here to demonstrate, it's just working in our test environment (make sure to update both Unity client and web server files to 2.1.13).
PS: please note that Ping/AutoPing will update lastSeen only on the localUser and not every User class object you instantiated (to update a User object, you still need to call Load method on it and eventually do your stuff in the optional callback passed to the method).
FRANCESCO CROCETTI @ SKARED CREATIONS
Thanks,
You're right, I didn't think to call Load on the local user when testing this. When I added that, the lastSeen started updating properly.
Do I also need to call Load on every User on the friends list after I update the friends list itself by calling CombuManager.localUser.LoadFriends? I've assumed so far that that call updates all information about the friends, not only the list itself. So that if after that call has succeeded, I iterate over CombuManager.localUser.friends, those will have the same UserStates as they have on the server.
LoadFriends already retrieves the latest data from database (including their lastSeen), so you don't need to call Load for each friend in the list but you only have to re-call LoadFriends from time to time to retrieve the latest data.
FRANCESCO CROCETTI @ SKARED CREATIONS