I'm transitioning from SmartFoxServer PRO, and I am wondering how to have a buddy list in a similar fashion to how SFS does it.
How SFS does it:
A user has a buddy list which contains all of the data that each buddy on the list has set as their buddy variables. A buddy variable might be a status message, or a nickname, or anything. If user1 is on user2's buddy list, and user1 changes his status buddy variable, user2 receives an event (if user2 is online) saying user1's buddy variables changed along with the updated buddy variables. Buddy variables can persist offline, so if user1 changes his status and user2 is offline, user2 will receive user1's new status the next time user2 logs in and loads the buddy list.
I need this functionality for my game, so I'm wondering how to achieve this functionality using Player.IO. Does Player.IO have any built-in buddy list features? If there are none, I was thinking of creating this functionality by doing the following:
1. Have a DatabaseArray that lists the names of friends, stored in a user's PlayerObject.
2. Changing one's buddy variables mean sending a message to the server which would call a function, which would then get the list of friends from the PlayerObject, and then it would send a message to all of the friends (who are online)
3. That function would also save one's buddy variables in the database, and when a user logs in, all of the buddy variables for their friends are retrieved and sent to the user
(I'm new to Player.IO, so please bear with me)
It seems like the above logic would be easy enough to implement, but after looking for a short while I wasn't able to find a way to 'get' a user in order to send them a message. In the GotMessage function there is a Player variable, and then a message can be sent to that player by calling player.send(), but how do I retrieve other player variables? If I got the list of names of friends from the database, how would I send all of those friends a message?
All help is appreciated,
Mark