Using two data sources with ember


#1

Hi, I’m writing a frontend with ember.js for a freeswitch conference.

To get the list of contacts I connected the REST adapter to my DB but of course the DB doesn’t know anything about the call state of the contacts.

I have to get the call state as CSV data by an AJAX web request. My thought was to poll the call state (interval ca. 10s) in the contacts-controller and then update every contact. On the other side I don’t think that the controller is the right place for getting data.

My question: Where is the right place to poll the conference state in my ember app and what’s the best practice for polling data and updating my model with them?

Thanks


#2

The router and more specifically, probably in afterModel or setupController is where I’d begin “polling”. On deactivate of the route you’ll want to turn the mechanism of polling off.