Hello,
Quick question... When a user joins a room, he doesn't get all the room variables automatically on join? setRoomVariables needs to happen before that (either caused by an action from another user or from the server itself) and the user needs to listen to ROOM_VARIABLES_UPDATE, am I right?
Thank you
Question on room variables updates
Re: Question on room variables updates
Bathory wrote:Hello,
Quick question... When a user joins a room, he doesn't get all the room variables automatically on join?
Yes, he does.
setRoomVariables needs to happen before that (either caused by an action from another user or from the server itself) and the user needs to listen to ROOM_VARIABLES_UPDATE, am I right?
It's two different things.
When you join a Room you automatically get all of the variables that are set in it with the ROOM_JOIN event.
If you want you can already cycle through all available variables, if any.
The ROOM_VARIABLES_UPDATE, is a different event that will be fired after you have joined one (or more) Room(s) to tell you that variables have been updated.
To recap:
ROOM_JOIN gives you the Room object containing all current variables.
ROOM_VARIABLES_UPDATE will trigger if changes are made to one or more RoomVariables, after you've joined.
Makes sense?
Re: Question on room variables updates
Absolutely thank you so much Lapo.
So far I was handling almost all data transmitted with custom requests and responses. Before I start using room/user variables more... from what I understand in the docs, there is continuous communication/acknowledgement between the client and the server to make sure variables updates are well processed (unless UDP is used)?
Let's say the client didn't receive a packet with room variables updates because of a temporary disconnect, when he returns, does he have to circle through the variables in CONNECTION_RESUME (I'm guessing no because I haven't seen any example that does that)... or in that case will ROOM_VARIABLES_UPDATE be fired multiple times? Or just once with the latest data?
Thanks again.
So far I was handling almost all data transmitted with custom requests and responses. Before I start using room/user variables more... from what I understand in the docs, there is continuous communication/acknowledgement between the client and the server to make sure variables updates are well processed (unless UDP is used)?
Let's say the client didn't receive a packet with room variables updates because of a temporary disconnect, when he returns, does he have to circle through the variables in CONNECTION_RESUME (I'm guessing no because I haven't seen any example that does that)... or in that case will ROOM_VARIABLES_UPDATE be fired multiple times? Or just once with the latest data?
Thanks again.
Re: Question on room variables updates
Bathory wrote:Absolutely thank you so much Lapo.
So far I was handling almost all data transmitted with custom requests and responses. Before I start using room/user variables more... from what I understand in the docs, there is continuous communication/acknowledgement between the client and the server to make sure variables updates are well processed (unless UDP is used)?
Yes this is correct.
I'd recommend checking our basic examples with source code to learn this a bit more in depth:
http://smartfoxserver.com/download/sfs2x#p=examples
Let's say the client didn't receive a packet with room variables updates because of a temporary disconnect, when he returns, does he have to circle through the variables in CONNECTION_RESUME (I'm guessing no because I haven't seen any example that does that)... or in that case will ROOM_VARIABLES_UPDATE be fired multiple times? Or just once with the latest data?
Yes the ROOM_VARIABLES_UPDATE will fire multiple times. In other words you will receive all events that the server wasn't able to send you during the temporary disconnection.
Cheers
Who is online
Users browsing this forum: No registered users and 42 guests