Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

With flash based games (or flex), is it a pull or request/response system or is it possible for the game server (say java based) to actually push out to its remote flash clients?

share|improve this question
1  
It depends on your method of communication. Are you using remoting/web requests or sockets? –  Luis Estrada Feb 28 '12 at 22:56
add comment

1 Answer

There are basically two different ways you can achieve "pushed" updates through flash. Using the Socket class is the most straightforward and gives you the most control. At this level, you can either exchange XML data or just read and write raw bytes. The only real downside is that some people might have trouble connecting depending on things like routers, firewalls and security software. There's also a tricky little bit about setting up a security policy server, which isn't made immediately obvious in the Socket API documentation.

The second method is to use a long polling HTTP request via the URLStream class. Essentially the client will make a regular HTTP request that stays open, then the server will push data down that connection as it becomes available, and the URLStream class allows you to process the data as it comes in. If the client needs to send any updates to the server, it can do so through regular HTTP requests, the tricky part is to ensure that something in that request reliably identifies the client so the server can apply the update properly (and securely).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.