IBM Worklight v5.0.5 > Develop IBM Worklight applications > Data synchronization with JSONStore
All the failure paths are handled and return error codes.
The push method synchronizes all documents modified locally. The pushSelected method takes as a parameter the ID of a specific document or documents. Both can fail if something goes wrong while native code is running to get the documents or verify that they are unsynchronized.
After the documents are retrieved, a Worklight adapter is called, using the appropriate option (add, replace, or remove). The adapter then tries to contact the back-end server. This attempt can fail if the adapter or procedure name does not exist, or if the WL server or back-end server cannot be reached.
If the server is successfully contacted, you can check the status code from the synchronization procedure and determine whether to mark that document as synchronized. This step uses native code and can fail.
Parent Data synchronization with JSONStore