Page 1 of 1

OnExtensionResponse sequence

Posted: 17 Apr 2013, 06:28
by Zelek
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?

Re: OnExtensionResponse sequence

Posted: 17 Apr 2013, 08:52
by Lapo
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.