I\'ve been poking around and I can\'t find any up to date examples of ember (1.0.0-rc.1) and ember-data(revision 11) that also use socket.io. I\'ve tried something like this.>
There's a very simple solution to this which I'm using in some of my apps. You can either have a general purpose callback for the socket and accept any kind of data
callback: function(message) {
// this is better than just `eval`
var type = Ember.get(Ember.lookup, message.type);
store.load(type, message.data);
}
or here it is specifically tailored to your use case
socket.on('apartment/new', function(apartment) {
store.load(App.Apartment, apartment);
});
using store.load
will load the record data directly into the identity map. There's also loadMany
for loading multiple records.