1 person found this helpful
Get rid of ENTER_FRAME! You simply cannot send 30 notifications out in a second continously. Better use a timer (which - in best case - knows about the current latency of the client and adjusts itself) which sends out a status every 10ms. Basically you cannot get under this time in any case and it's much, much, much more performant.
Besides I wouldn't always set up a new ByteArray. Instead try just clearing & re-writing it.
Thank you for the answer.
A timer with 10ms between each iteration still lagged a lot. Right now I'm using 50ms which gives a more reasonable performance but it's still a bit laggy. I don't recall sending messages to a server through RTMP causing similar lag.
do you have any kind of connection log to determine where the loss / lag appears? e.g. what is the difference between an outgoing request and it's income at the other peer? or is it actually a flashside problem?
Unrelated to your question, but as NetGroup.post() supports any AMF-serializable object, there's no reason to write the contents of your object into a byte array. Just make a "position report" object and put the parameters in it.