I have a Meteor application and I want be able to check on the client side when all the changes made by the client to a published Collection have been written to the server.
I've looked at minimongo and the code in the ddp-server, but I don't see any straightforward way to tell when the changes have been successfully written to the server.
Minimongo outline the process for saving data:
- User triggers an interaction on the client
- The simulation applies some mutations to the state locally
- The RPC is fired to be executed on the server
- After some time, the RPC returns with the result
- After some more time, RPC returns an "updated" message (on DDP level), meaning that all the changes from RPC have persisted
- At this point we know, that all the actual changes from the server are synced, we can throw away the simulated mutations (preserving the real changes from the server)
I can override LocalCollection.prototype.saveOriginals
and LocalCollection.prototype.retrieveOriginals
to know when they are each called, but I'm not sure how to verify when the data is actually saved. retrieveOriginals
is getting called even when the Meteor server is down.
Is there any other place to hook a callback in or listen for an event to know when changes are synched?