First thing first it depends how fast you want to poll your server for data. As 
you probably know the browser only allows you to have 2 connections ... You 
might run into issues if your polling again and again in seconds. We have 
something similar and decided to make our own ServiceManager class which uses 2 
HTTPService instances and manages  the concurrency for the 2 connections. So 
when you make a request the service manager schedules that request and when it 
has the service avalable is doing the request ... We are still using commands, 
but not delegates anymore. The HTTPService handles the results and parses the 
data through some unmarshaller classes into the model ... It is not the 
greatest separtion of concerns but since we are polling the hell out of the 
server we hit serveral tomeouts due to bad request schedulling ...

Traditionaly with cairngorm after you get the data dreom the server you 
populate the model and update the view through bindings. You can hav an message 
mechanism and trigger it directly form the model, or dispatching events handled 
by commands. As far as the indicator goes the same thing ... use a preloader 
with alternate set to true inside the message view or somewhere .... show when 
make request, hide when result or fault ...

The topic is 2 large to tackle in 2 paragraphs but if you need further info 
senf a private msg ...

Cheers,
Claudiu


________________________________
From: Osman Ullah <[email protected]>
To: [email protected]
Sent: Tuesday, March 24, 2009 4:03:22 PM
Subject: [flexcoders] Using cairngorm for "push" events


I am using cairngorm on my current project and I have run into a couple issues 
which I am having trouble dealing with through Cairngorm. Hopefully someone can 
help.

1) I have an event loop which is polling my web service for events. Where would 
be the best place to run this event loop and what would be a good way of 
notifying the view to "do something"? There might be very little data, so it 
might be something like popping an alert or popping a toast notification. 
..it's not something I can do through databinding and cairngorm seems to throw 
out the whole concept of the model notifying the view through events (this 
design decision is something I don't really understand). 

2) I want to make a request, and show a loading indicator while the request is 
pending, and then show a confirmation with the result of hte request. Similar 
requests are being made in different parts of the application, but they all 
consist of making the request, showing a wait indicator, and then showing a 
confirmation. Again, some suggestions on how to handle this would be 
appreciated.

Thanks


   


      

Reply via email to