I have a few questions about uservariables :
1) Why isnt there a "setVariable()" function, so I can set/change a single uservariable instead of collecting all uservariables in total and post them using "setUserVariables()" function ? It seems like "overkill" that I have to send all variables each time one of my variables has changed ...
2) When I change the uservariables using "setUserVariables()", what actually happens "on the TCP socket" ? Is a notification send to each user about the uservariables changes, or are ALL uservariables actually sent "down the wire" to each user ? I mean, if a heavy user has 100 uservariables, all being a long string, and one of these are changed, will each user in the room then recieve 100 * strings "downloaded" from the server into their client ?
Thanks for making a great product
-
Regards from Copenhagen,
Tony Fonager
More questions about userVariables!
Again, sorry for the delay in responding. For some reason I did not receive notifications about the new topic.
Back to your questions:
1)
Setting server variables (UserVars, RoomVars) is already optimized. You don't have to send all the data every time and you receive only variables that where changed.
If you take a look to the Avatar Chat example you will notice that we're updating only the data we need (px, py and init) but we don't send the color of the avatar each time. The color is created once and never sent again.
Also by using the setUserVariables() method you can decide to update one single variable only or a group of variables in one shot, making it pretty flexible.
2)
As I said before only variables that where changed are broadcasted to the other users in the room.
It is obviously important to optimize the type of data you're using: if you end up having 100 long strings you should rethink your application because that would be very heavy in terms of bandwidth usage.
In other words the data sent through the TCP socket is only representing the updated variables.
Let me know if you have more questions.
Back to your questions:
1)
Setting server variables (UserVars, RoomVars) is already optimized. You don't have to send all the data every time and you receive only variables that where changed.
If you take a look to the Avatar Chat example you will notice that we're updating only the data we need (px, py and init) but we don't send the color of the avatar each time. The color is created once and never sent again.
Also by using the setUserVariables() method you can decide to update one single variable only or a group of variables in one shot, making it pretty flexible.
2)
As I said before only variables that where changed are broadcasted to the other users in the room.
It is obviously important to optimize the type of data you're using: if you end up having 100 long strings you should rethink your application because that would be very heavy in terms of bandwidth usage.
In other words the data sent through the TCP socket is only representing the updated variables.
Let me know if you have more questions.
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 36 guests