Syncano / syncano-js

Javascript SDK to interact with Syncano API. Full SDK Docs ->
http://syncano.github.io/syncano-js/
22 stars 3 forks source link

Realtime improvements proposal #153

Open farwayer opened 8 years ago

farwayer commented 8 years ago

Realtime sync of class objects via channels is too complex for now. Ideal it must be mix of complex queries (like LiveQueries from parse) with fast background sync from Firebase.

Something like this:

// object is created and it fulfills the filter
instance.class('CLASS_NAME').list(filter).on('create', (object) => {
   console.log("new filter object");
});

// an existing object which fulfills the filter you subscribe is updated
instance.class('CLASS_NAME').list(filter).on('update', (object, prevObject) => {
   console.log("filter object changed");
});

// 'enter', 'leave', 'delete' events from parse

// killing feature for technologies like react
// like 'value' event in Firebase
// newObjectList contains all filtered objects after background sync
instance.class('CLASS_NAME').list(filter).on('list_update', (newObjectList) => {
   console.log("list changed");
});
jakubbilko commented 8 years ago

Thank you for your input @farwayer, we'll take a look at it during our libraries meeting.