Page 1 of 1

Pause messages in client side.

Posted: 10 May 2008, 13:18
by Gamebrew
I had this feature when I made my own Java server. The ability to pause all incoming and outgoing messages with a function like setPaused(boolean). Every single in/out message will be put in a queue (onExtensionResponse, onJoinRoom etc) and when you setPaused(false), it will run each one.

This is especially useful for Flash because sometimes you transition between screens and the time it takes to transition varies. It's good when replacing the SFS functions and you don't want messages in the middle of it. This is also a very difficult bug to find as I discovered recently.

One of the examples pushes the onExtensionResponse in a queue and runs them in the next screen, but this would be much easier for non-single object messages.

Thanks!

Posted: 21 May 2008, 15:08
by patso
I also think that similar feature may be very handy.

In project I needed to implement a simple event queue. All messages received by the client are queued and when the client is ready to process the next message just gets it from the queue(actually the real implementation was a bit more complicated but important is the idea :) ).

Anyway it's not complicated to implement similar logic but the more features the merrier :)

Posted: 22 May 2008, 07:12
by Lapo
mmm... it's a double edged sword.
We used a queue in the old Actionscript 2.0 examples specifically for not loosing the roomList message if it was fired before the frame switch.
But today with AS3, Flex etc... using multiple frames is not really recommended.

That's the only use I could see for that. Pausing messages looks like it creates more problems than what it can solve.

If you enqueue messages for whatever reason, then you will have to deal with them at once in order to get back in synch with the new data arriving. This can cause all sorts of problems: CPU hogs, strange rendering behaviors (imagine if you handle 10 movements of an avatar at once), etc...

I still see this as an application-specific feature than a real useful, all-purpose feature of the API

Posted: 22 May 2008, 19:27
by patso
Lapo wrote:mmm... it's a double edged sword.
We used a queue in the old Actionscript 2.0 examples specifically for not loosing the roomList message if it was fired before the frame switch.
But today with AS3, Flex etc... using multiple frames is not really recommended.

That's the only use I could see for that. Pausing messages looks like it creates more problems than what it can solve.
I think also is useful when you need not to process more game messages while animation is playing.
Lapo wrote:If you enqueue messages for whatever reason, then you will have to deal with them at once in order to get back in synch with the new data arriving. This can cause all sorts of problems: CPU hogs, strange rendering behaviors (imagine if you handle 10 movements of an avatar at once), etc...
In turn based games this is not an issue(at least not in all).
Lapo wrote:I still see this as an application-specific feature than a real useful, all-purpose feature of the API
Yep I suppose it's not all-purpose.