Are all User Variables/Room Variables/Buddy Variables ready?

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Are all User Variables/Room Variables/Buddy Variables ready?

Postby hoangdoanh » 10 Apr 2014, 04:48

Hi

SmartFoxServer maintain data of all Server Variables among to all necessary devices/platforms.

But those data need time to updates to all devices.

The question is that after User Joined Room, are all data of Room Variables/User variables of other users in room/Buddy Variables ready to read on client-side?

Could you please clarify that !

Cheers,
Doanh
User avatar
Bax
Site Admin
Posts: 4412
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby Bax » 10 Apr 2014, 08:03

Yes they are. When you receive the "ROOM_JOIN" event (which confirms that a Room has been joined successfully) all Room Variables and User Variables (of users inside the Room) have already been transmitted to the client.
For the Buddy Variables the event after which they are available is "BUDDY_LIST_INIT".
Paolo Bax
The SmartFoxServer Team
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby hoangdoanh » 10 Apr 2014, 08:59

Thanks Bax !

It help us to assure that everything are ready after some event occurs !

Kind regards,

Doanh
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby hoangdoanh » 10 Apr 2014, 10:35

By the way,

Could you please tell me comparison of happening time for the same event on server-side and client-side.

For example USER_JOIN_ROOM Event.

We have RoomJoinHandler for executing USER_JOIN_ROOM event.

Code: Select all

public class RoomJoinHandler extends BaseServerEventHandler {

   @Override
   public void handleServerEvent(ISFSEvent event) throws SFSJoinRoomException, SFSVariableException, SFSRoomException {
      User    user    =  (User)event.getParameter(SFSEventParam.USER);

   //The following code change User Variable.

        initUserVariable(user) ;

}
}

Which case is correct ?

1.The event on client side is fired after completion of handleServerEvent and delivery of UserVariable Data (of this user, that has just joined).
2.The event on client side is fired after completion of handleServerEvent and before delivery of UserVariable Data.
3.The event on client side is fired before completion of handleServerEvent.

Thanks,
Doanh
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby hoangdoanh » 11 Apr 2014, 04:14

After reading some information about Room Events/Permissions.

I understand that we can set which events allowed in each room.

The problem is in USER_VARIABLE_UPDATE_EVENT.
if it is not set. User on client-side can not get any USER_VARIABLE_UPDATE_EVENT(event if his user variable is changed).
if it is set. User on client-side can get any USER_VARIABLE_UPDATE_EVENT of all users( if room has many users, for example Lobby or MMO Game Room) Transfer data to all clients will be heavy.

Is there anyway to allow user get user_variable_update_event of only his User Variables (not get data from another users).

Thank you very much

Doanh
User avatar
Bax
Site Admin
Posts: 4412
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby Bax » 11 Apr 2014, 08:45

hoangdoanh wrote:Which case is correct ?

1.The event on client side is fired after completion of handleServerEvent and delivery of UserVariable Data (of this user, that has just joined).
2.The event on client side is fired after completion of handleServerEvent and before delivery of UserVariable Data.
3.The event on client side is fired before completion of handleServerEvent.

Case 1.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4412
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby Bax » 11 Apr 2014, 08:50

hoangdoanh wrote:Is there anyway to allow user get user_variable_update_event of only his User Variables (not get data from another users).


This is not possible. You will need to set the User Variable as "hidden" (which prevents the variable to be sent to all the clients, owner included) and then send its value manually to the owner using an Extension response.

By the way, if you work with MMORooms, the User Variable update event will be sent to the users within the Area of Interest of the variable's owner only.
Paolo Bax
The SmartFoxServer Team
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: Are all User Variables/Room Variables/Buddy Variables re

Postby hoangdoanh » 11 Apr 2014, 10:20

Hey Bax

After your answer we have solution for our problem now.

At first sight, I was a bit disappointed because Normal room do not support User updates only his event, for easily reading information on client-side, and reduce bandwidth due to not updates from other users. But luckily MMO Game Room can support this feature.

Thank you very much
Doanh

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 1 guest