Is it possible to block or restrict the number of rooms is sent when a roomList update event is triggered. I actually don't even want this event but the flash doesn't seem to work correctyly if it doesn't get at least one room list update when loggin in.
My issue is I have thousands of rooms dynamically created on the server and the flash doesn't need to know about them. Buy my send room list call is part of the login code and it sends the list of all the rooms. If I don't send the room list, I find that the connection between the flash and sever will drop much faster than the timeout set for the connection.
How to block roomList updates?
I don't think there is an InternalEventObject for the roomList update. In my case, this wouldn't matter because I am calling sendRoomList() after a user successfully login from the server and so it is not a client triggered event. What I am really looking for is a way to control what sendRoomList() function in java sends.
Is it possible to block or restrict the number of rooms is sent when a roomList update event is triggered. I actually don't even want this event but the flash doesn't seem to work correctyly if it doesn't get at least one room list update when loggin in.
You can fake the roomList message sending only the details of the room that you need.
It can be done by using the sendGenericMessage method that allows to send any data to the client. Here's a snippet of Actionscript code that sends a room list containing one room only:
Code: Select all
// Only send info about the current room
function sendSmallRoomList(r, who)
{
var msg = "<msg t='sys'><body action='rmList' r='-1'>"
msg += "<rmList><rm id='" + r.getId()
msg += "' priv='" + (r.isPrivate() ? "1" : "0")
msg += "' temp='" + (r.isTemp() ? "1" : "0")
msg += "' game='" + (r.isGame() ? "1" : "0")
msg += "' ucnt='" + (r.getUserCount())
msg += "' maxu='" + r.getMaxUsers()
msg += "' maxs='" + r.getMaxSpectator()
msg += "'><n><![CDATA[" + r.getName() + "]]></n></rm></rmList>"
msg += "</body></msg>"
_server.sendGenericMessage(msg, null, [who])
}
Blocking roomlist updates
We have a custom login extension that sends the roomlistupdate to the client after login. However, we noticed that clients continue to get roomlistupdates from the server periodically as there are changes to the number of users in a room. Is there a way to switch off this behavior? We want clients to request a new room list when they want one rather than have it pushed to them.
Thanks in advance for any advice.
Thanks in advance for any advice.
In general that's not a good idea.
You can suppress the userCount updates which informs you in real time of the number of users in any Room.
I would not recommend stopping the updates that notify new Rooms being added or removed.
An example is that if you don't get updates for the Rooms that are removed you might attempt to join Rooms that don't exist anymore.
Each Room created can be configured not to fire userCoutUpdates.
You can also inhibit other events if you wish to and once you understand the consequences of that.
All the details are found in Chapter 2.1 of the docs:
http://www.smartfoxserver.com/docs/
You can suppress the userCount updates which informs you in real time of the number of users in any Room.
I would not recommend stopping the updates that notify new Rooms being added or removed.
An example is that if you don't get updates for the Rooms that are removed you might attempt to join Rooms that don't exist anymore.
Each Room created can be configured not to fire userCoutUpdates.
You can also inhibit other events if you wish to and once you understand the consequences of that.
All the details are found in Chapter 2.1 of the docs:
http://www.smartfoxserver.com/docs/
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 57 guests