Ember Data Sycn - LocalStorage+REST+RealTime+Online/Offline
Posted
by
Miguel Madero
on Stack Overflow
See other posts from Stack Overflow
or by Miguel Madero
Published on 2013-10-18T19:46:02Z
Indexed on
2013/10/19
3:55 UTC
Read the original article
Hit count: 237
ember.js
|ember-data
We have a combination of requirements in terms o data access.
- Pre-load some
reference
data. - We need reference data to survive browser restarts instead of just living in memory to avoid loading it all the time. I'm currently using the
LocalStorageAdapter
for that. - Once we have it, we would like to
sync changes
(polling or usingSocket.IO
in the background and updating the LocalStorage could do the trick) - There're other models that are more transactional, where we would need to directly go to the Server and get/save them. It would be nice to use something like the RESTAdapter for that.
- Lastly, there're some operations that should work
off-line
and changes should be synced later.
To make it more concrete:
* We pre-load
vendor and "favorite products" into Local Storage. We work offline with those.
* We need to sync server changes to vendor and product information.
* If they search the full catalog, that requires them to be online.
* When offline, we need to allow users to add something to their cart or even submit and order. We would like to queue this action and submit it when they have an Internet Connection.
So a few questions are derived from this: * Is there a way to user RESTAdapter in combination with LocalStorage? * Is there some Socket.IO support? (Happy to do this part manually) * Is there Queueing support? Ideally at the Ember-Data level.
I know we will have to do a lot of this manually and pull together the different lego pieces, but I wanted to ask for some perspective from experience Ember devs.
© Stack Overflow or respective owner