I’m trying to wrap my head around this, and looking for suggestions:
In ordinary operation, our system calls upon several external web
services to gather info – these steps can take a while and we want to
give our users feedback on what’s happening.
My hunch is that a state-driven model, using AASM or equivalent, is a
good start. What I’d like is a general mechanism that notifies the user
by pushing out javascript as AASM moves from one state to another
(“preheating the oven”, “beating the eggs”, “folding in the dry
ingredients”, …)
Aside from the fact that I’ve never written a line of AJAX in my life,
I’m not sure how to partition the functionality. Perhaps I should
create a callback-style hook in the model so a view can express interest
in being notified? (But then what happens when the view isn’t actually
being displayed?)
Mostly, it I suspect this is a common problem many others have solved
already. I’d welcome suggestions or pointers.
TIA.
- ff