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.
TIPS: The new Room List and Room Groups
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?
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?
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).
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).
Create Group at run time and Assign room to each group.
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.
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).
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.
Switch between rooms
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
- Carl Lydon
- Posts: 298
- Joined: 12 Nov 2007, 16:15
- Location: NYC
- Contact:
Re: TIPS: The new Room List and Room Groups
There is a typo above:
defaultGrouo = "default,chess"
Should be
defaultGroup = "default,chess"
defaultGrouo = "default,chess"
Should be
defaultGroup = "default,chess"
Who is online
Users browsing this forum: Stevenor and 114 guests