Question

I would like to use http polling instead of socket in my flash application.

Does http polling every 0.5 seconds can be problematic? (In terms of synchronization and performance).

Was it helpful?

Solution

It depends on your task. For example, if you want to poll all lifetime of your client application, I would go with higher poll interval (several seconds) or go with socket connection. But if your task to send something and wait for completion of async process on server-side, polling will be a nice approach. And in your PollingService, wait for response from the server, and after 500ms timeout, do next request, you will not have any synchonization problems at all.

//delay 500 ms between response from the previous request and future request
var service: PollingService = new PollingService(500); 
service.start();

For realisation of such service you will need only 2 classes: URLLoader and Timer. And maybe signals or EventDispatcher ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top