Updating the friends list

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Ber4ber43
Posts: 79
Joined: 30 Apr 2019, 14:35

Updating the friends list

Postby Ber4ber43 » 25 May 2020, 19:42

Hi,

I need help on the logic of a custom friends list, I don't understand when it is better to update the various states of the user, it is better:
1) Send your change of status to your entire friends list (Online, Offline, InGame, ExitClan, EnterClan, ChangeUsername)
2) Send the user an update of all friends every 60 seconds
3) Send the user an update of the list every time he opens the friends list, but when the state changed the user could have the friends list open, so he would continue to see the previous state
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Updating the friends list

Postby Lapo » 26 May 2020, 06:44

Hi,
why not using the existing BuddyList API?
those states are already handled by the Buddy List API, for you, so you don't have to implement any special logic.
Have you checked the documentation?
http://docs2x.smartfoxserver.com/Advanc ... y-list-api

Also you can find practical examples of how to use the BuddyList API in almost all supported platforms:
https://www.smartfoxserver.com/download#p=examples

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ber4ber43
Posts: 79
Joined: 30 Apr 2019, 14:35

Re: Updating the friends list

Postby Ber4ber43 » 26 May 2020, 11:43

Hi,
I like to have control of everything on my server, can you please help me with the logic?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Updating the friends list

Postby Lapo » 26 May 2020, 16:22

1) Send your change of status to your entire friends list (Online, Offline, InGame, ExitClan, EnterClan, ChangeUsername)

Sounds like the normal solution. When a user changes its state you need to update all the other clients that have this User in their list.

2) Send the user an update of all friends every 60 seconds

This can be more expensive if the state of a certain amount of friends did not change and it's also very delayed as you don't get a real-time update.

3) Send the user an update of the list every time he opens the friends list, but when the state changed the user could have the friends list open, so he would continue to see the previous state

Doesn't sound like a good strategy.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Ber4ber43
Posts: 79
Joined: 30 Apr 2019, 14:35

Re: Updating the friends list

Postby Ber4ber43 » 26 May 2020, 18:27

Thank you

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 64 guests