when set, indicates which entity caused a disconnection.
This is set to an entity name to limit which entity may cause a change to online state again.
server associated with this store.
The sync method will fail early when being applied to data of some other server.
identity or user associated with this store.
The ajax method will simulate an offline timeout when the user identity is changed. This is because just one session can be maintained per server and login/logout semantics must be well behaved.
feeds pending offline #messages to the remote server.
Due to client code setting up models one at a time, this method is called multiple times during initial setup of #endpoints. The first call fetches pending offline #messages, ordered by priority and time. Then the #messages are send to the remote server until depleted, an error occurs, or some missing endpoint is encounted.
The method is triggered each time an endpoint is registered, or state changes to online for any endpoint. When state changes from offline to online (disregarding endpoint) message submission is restarted by resetting the #messagesPromise. Otherwise, subsequent calls chain to the end of #messagesPromise.
of #messages Collection, or last recent offline rejection
close the socket explicit
usually a collection, but can also be a model
usually a collection, but can also be a model
binds the store to a target server when the first endpoint is created.
used to resolve the server to operate.
called when an offline change was sent to the remote server.
May be overwritten to alter change message error handling behavior. The default implementation will attempt reloading the server data for restoring the client state such that it reflects the server state. When this succeeded, the offline change is effectively reverted and the change message is dropped.
An overwritten implementation may decided whether to revert failed changes based on the error reported.
Notice, the method is not called when the offline change failed due to a connectivity issue.
reported by remote server.
change reported, attributes of type LiveDataMessage.
context information required to access the data locally as well as remotely.
Promise indicating success to drop the change message and proceed with the next change, or rejection indicating the change message is kept and retried later on.
Generated using TypeDoc
connects a Model/Collection to a Relution server.
This will give you an online and offline store with live data updates.
// The default configuration will save the complete model data as a json, // and the offline change log to a local WebSql database, synchronize it // trough REST calls with the server and receive live updates via a socket.io connection. class MyCollection extends Relution.livedata.Collection {}; MyCollection.prototype.model = MyModel; MyCollection.prototype.url = 'http://myServer.io/myOrga/myApplication/myCollection'; MyCollection.prototype.store = new Relution.livedata.SyncStore({ useLocalStore: true, // (default) store the data for offline use useSocketNotify: true, // (default) register at the server for live updates useOfflineChanges: true // (default) allow changes to the offline data });