문제

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).

도움이 되었습니까?

해결책

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 ;)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top