I have a senario like this - will be sending position update message to each user in a perticular room, this is like every sec. I need to control the network traffic to the client, is there a way i can setup some time fixed and post these messages, any examples on this will be gr8 help.
Thanks,
Send message at a FixedRate
hi. To achive that you can try using the Scheduler, which is used to schedule a task to occur in a specific interval
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
rjgtav wrote:hi. To achive that you can try using the Scheduler, which is used to schedule a task to occur in a specific interval
Thank you.
so i want to send user variables/Room variable update to client at a perticular time in the form of packet. so the client side will unpack and use the variables. how do i achive this.
Thanks in advance
Hi. For a tutorial about using the Scheduler, you can check here:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
rjgtav wrote:Hi. For a tutorial about using the Scheduler, you can check here:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
i am scheduling at every 3 sec once the user variable update will be sent to all room users. to reduce the network traffic on server side.
but when i collect all the incoming user variable update and packet it. while sednging them in a perticular interval facing one problem, the user who is sending should not receive user variable update. how do i do this.
here is the code iam using on server side
result= new SFSArray();
result = map.get(currentRoom.getId());
result.addSFSObject(object);
map.put(currentRoom.getId(), result);
map is a hash map.
in the looping task will read through the Map and send the packet per room,
Set<Integer> set = map.keySet();
for(Integer ks:set){
object.putSFSArray("arr", response);
send(CMD_SET_USER_VARIABLES, object,userList);
//userlist getting it using the roomId.
but all user's of that room will be receiving these updates, how to avoid not to receive user who sent the update req.
Thanks in advance.
Hi. To achieve that you need to create a new List, where you put all the users except the sender.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
rjgtav wrote:Hi. To achieve that you need to create a new List, where you put all the users except the sender.
Hi,
i am using the schedular to send message packet at a fixed rate. i read the document and using the same way.
we have TaskRunner implements Runnable in this class their is a call taskHandle.cancel().
we have to pass value to this method either true/false
what actully this cancel will do.what value we should put true/false.
Thanks in advance.
Who is online
Users browsing this forum: No registered users and 141 guests