TIPS: The new Room List and Room Groups

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

Moderators: Bax, Lapo, rjgtav

TIPS: The new Room List and Room Groups

Postby Lapo » 30 Jul 2010, 05:15

Every one who is familiar with SFS 1.x knows that the client is quite strict on the subject of Room List.
The client must always call the getRoomList() method before getting started etc...
As expected by many we have dealt with this rigidity from the grounds up with SFS2X and the problem no longer exists.
The Room List will always be available at any moment on the client side, there's no manual request to send and the updates are all transparent.

Room Groups
One of the most important settings in the SFS2X Zone is the defaultGroups value. Here you specify which Room Groups the User will be subscribed to when he is logged in the Zone.

By default SFS2X defines one single group called "default" and, unless you configure it differently, this is the only group that any User is auto-subscribed to upon login.

This makes SFS2X behave exactly like his predecessor. The fun stuff begins when you add more Groups to the mix and let the User listen to their events by configuring the defaultGroups value.

Let me give your a few examples:
defaultGroup = ""
This is equivalent to listening to the "default" Group, no particular surprises. The User acquires the Room list of this group at login time and will receive updates just for this Group

defaultGroup = "default,chess"
The User will receive a RoomList containing the Rooms from the two specified Groups and will keep receiving update events from those two.

etc... you should get the idea

Dynamic Group subscription:
Here comes the fun part. Not only you can choose what the User should "see" as soon as he joins the Zone but you can dynamically choose which Groups to listen or avoid at any time at runtime.

There are two new requests called SubscribeGroup and UnsubscribeGroup which will allow the developer to add or remove all Rooms from a Group (and relative events) to the client Room List.

Of course the client and server API allow you to easily search for Rooms from a specific Group etc... Additionally the SmartFoxBits 2X UI components already provide support for this feature.

Want to play a game of Black Jack?
Subscribe to the "BlackJack" Group and voilà, the client obtains an updated Room List with all the Rooms/Games from that place.
Everything is kept in sych behind the scenes and when you're done with playing Black Jack games you can drop the Group and stop listening to its events.

More advanced Room stuff:
You can join any Room by knowing its name or Id even if its not in your current Room List.
For example this allows Users to invite each others in their respective places without any pain. If these Rooms are out of the current client scope the system will figure it out and transparently update the client.

This approach can be useful when you want the User to join a specific Room without having to subscribe to the Room Group and receive all its events.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
 
Posts: 15672
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby xLite » 13 Apr 2011, 23:23

Is there anyway to scrap the room list? It's so innefficient sending the client information of other rooms which it may never need. I'd rather the server handle everything and send the rooms that the client wants to deal with. So when the user logs in, the server joins it to the appropriate room and sends the room data to the user and all events in that room. Then when the users wants to switch room the server joins the user to the new room, leaving the old one and sends the data for that room etc.

I've never liked sending all the rooms at once, groups doesn't help either. Is there a way to just ignore this room list idea altogether?
User avatar
xLite
 
Posts: 106
Joined: 05 May 2010, 12:42

Postby Democre » 13 Apr 2011, 23:49

I think if you assign rooms to groups other than default, and just leave your users subscribed to the default group, then the users will not get the list of rooms from other groups. They would get an empty list of rooms for the default group if there are no rooms in that group.
Democre
 
Posts: 77
Joined: 16 Sep 2010, 17:58

Postby xLite » 16 Apr 2011, 15:37

Is that the best method or is there a way of disabling the client side room list altogether via a built in command perhaps?
User avatar
xLite
 
Posts: 106
Joined: 05 May 2010, 12:42

Postby Democre » 17 Apr 2011, 18:30

I believe this is the closest you will get to "disabling" the room list. You will in effect get no room list if your user is not subscribed to the groups which contain rooms.

I may be wrong, but I have not seen any such API to disable room lists. It is a subscription model, so your clients would merely not subscribe to the room groups. You can use the API method UnsubscribeGroup (as mentioned in the original post) to explicitly unsubscribe from room groups. I have not played around with unsubscribing from all groups. Instead, I have done what I mentioned above, and left the client subscribed to default group and creating all rooms in other groups. My client never gets any of those rooms. I don't have an event handler for room list changes, so I don't know if the client is still getting any room list updates (even if they are empty).
Democre
 
Posts: 77
Joined: 16 Sep 2010, 17:58

Create Group at run time and Assign room to each group.

Postby peter890 » 31 May 2011, 11:27

Iam new to the SFS2x, want to learn on Room/group which is new in SFS2x.
can any one guide how to create group at run time and assign rooms to it.

Democre wrote:I believe this is the closest you will get to "disabling" the room list. You will in effect get no room list if your user is not subscribed to the groups which contain rooms.

I may be wrong, but I have not seen any such API to disable room lists. It is a subscription model, so your clients would merely not subscribe to the room groups. You can use the API method UnsubscribeGroup (as mentioned in the original post) to explicitly unsubscribe from room groups. I have not played around with unsubscribing from all groups. Instead, I have done what I mentioned above, and left the client subscribed to default group and creating all rooms in other groups. My client never gets any of those rooms. I don't have an event handler for room list changes, so I don't know if the client is still getting any room list updates (even if they are empty).
peter890
 
Posts: 12
Joined: 31 May 2011, 04:01

Postby Lapo » 31 May 2011, 12:28

Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
 
Posts: 15672
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby peter890 » 01 Jun 2011, 04:47

Lapo wrote:http://docs2x.smartfoxserver.com/DevelopmentBasics/join-and-create-rooms
http://docs2x.smartfoxserver.com/Develo ... chitecture



Thank you.

Creating room and assign to a group , i need to do at server side using Java.

Also send public message to all user's who are in that group.
peter890
 
Posts: 12
Joined: 31 May 2011, 04:01

Postby Bax » 01 Jun 2011, 08:54

Please read the server-side API Javadoc: you will find all the methods to do what you need. Start from the ISFSApi interface.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
 
Posts: 3846
Joined: 29 Mar 2005, 09:50
Location: Italy

Postby peter890 » 02 Jun 2011, 11:58

bax wrote:Please read the server-side API Javadoc: you will find all the methods to do what you need. Start from the ISFSApi interface.



ok thankq
peter890
 
Posts: 12
Joined: 31 May 2011, 04:01

Switch between rooms

Postby peter890 » 08 Jun 2011, 08:51

peter890 wrote:
bax wrote:Please read the server-side API Javadoc: you will find all the methods to do what you need. Start from the ISFSApi interface.



ok thankq


how do i switch between zones using groupId
peter890
 
Posts: 12
Joined: 31 May 2011, 04:01

Postby Bax » 08 Jun 2011, 12:19

You can't switch zones. The Zone is selected during the login process. In order to switch zone you have to logout and login again.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
 
Posts: 3846
Joined: 29 Mar 2005, 09:50
Location: Italy

Re: TIPS: The new Room List and Room Groups

Postby Carl Lydon » 02 Mar 2014, 05:00

There is a typo above:

defaultGrouo = "default,chess"
Should be
defaultGroup = "default,chess"
User avatar
Carl Lydon
 
Posts: 259
Joined: 12 Nov 2007, 16:15
Location: NYC

Re: TIPS: The new Room List and Room Groups

Postby Lapo » 02 Mar 2014, 12:48

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
 
Posts: 15672
Joined: 21 Mar 2005, 09:50
Location: Italy


Return to SFS2X Questions

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest