I have the following code:
var type = store.modelFor(name); var serializer = store.serializerFor(type.typeKey); var data = $.parseJSON( message ); var record = serializer.extractSingle(store, type, data); store.push(name, record);
Which is fired when the server sends a (SignalR - web sockets) message to notify the app that there has been a record updated.
I know I need to be doing 2 things which I can’t figure out:
1 : how can I see if the record exists locally without going off to the server to fetch it - I only want to update records that exist locally so as to not overload the store
2: calling store.push seems to want to reflect the changes to the record to the server - this is not wanted as obviously the changes came from the server - how can I stop this?