Actually, none of the Ember-Data adapters return objects immediately. How would they? REST is asynchronous too. :) What they're returning are proxies for objects. Specifically, DS.PromiseObject
and DS.PromiseArray
. They allow you to work with the objects as if they were real, and as soon as the asynchronous promise resolves, the bindings get updated automatically.
So here's a quick example (somewhat pseudocode):
find: function(store, type, id) {
var promise = new Ember.RSVP.Promise(function(resolve) {
socket.emit('get data', function(data) {
resolve(data);
});
});
return DS.PromiseObject.create({
promise: promise
});
}
This is how the built-in adapters handle things, so this will exhibit the exact same behavior that you've been seeing with the other adapters.