OnExtensionResponse sequence

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

User avatar
Zelek
Posts: 36
Joined: 24 Jun 2010, 22:36

OnExtensionResponse sequence

Postby Zelek » 17 Apr 2013, 06:28

I am finding that I frequently need to send a batch of messages from the server that must be executed sequentially on the client. Let's say I do something like this on the server:

Code: Select all

SFSExtension.send("Message1", ...);
SFSExtension.send("Message2", ...);
SFSExtension.send("Message3", ...);


Can I be certain that my OnExtensionResponse function on the client will always process them one at a time, in the order they were sent, even if one of the messages potentially takes a long time to process?

Or do I need to have the client tell the server when it finishes processing each message before the next one can be sent?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: OnExtensionResponse sequence

Postby Lapo » 17 Apr 2013, 08:52

Hi,
sending messages in sequence should be optimized. If by sequence you mean one after the other like in a for loop or with just a few millis of difference I would highly suggest to aggregate them into one packet.
It will help a lot in optimizing the traffic. Also clients might suffer for a fast bombardment of small packets. (e.g. some mobile phones will disconnect)

Can I be certain that my OnExtensionResponse function on the client will always process them one at a time, in the order they were sent, even if one of the messages potentially takes a long time to process?

Messages on the client are handled sequentially so there should be no problem.
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 17 guests