| | 1 | {{{ |
| | 2 | #!html |
| | 3 | |
| | 4 | <h2>Sync Process</h2> |
| | 5 | <ol> |
| | 6 | <li style="margin-bottom: 1em;">Zotero client sends a /login request to the server with a username |
| | 7 | and password and, upon successful authentication, gets back a session |
| | 8 | key. Z client uses this session key in all subsequent requests until a) |
| | 9 | Firefox is restarted, b) the key expires due to inactivity, or c) the |
| | 10 | client logs out with a /logout request.</li> |
| | 11 | <li style="margin-bottom: 1em;">Zotero sends a /lock request to the server to get an exclusive |
| | 12 | session lock, which prevents other clients from syncing at the same |
| | 13 | time. This may be adjusted in the future to allow other clients that |
| | 14 | haven't made local changes to pull updated data, but for now they'll |
| | 15 | just get an error.<br> |
| | 16 | </li> |
| | 17 | <li style="margin-bottom: 1em;">Zotero finds all objects (items, creators, collections, etc.) that have been added, changed, or deleted since the last time it synced. (The ids of deleted objects are saved by a Zotero.Notifier observer at delete time.)<br> |
| | 18 | </li> |
| | 19 | <li style="margin-bottom: 1em;">Zotero sends an /updated request with the server timestamp of the |
| | 20 | last successful sync. Z server sends back XML of all data updated on |
| | 21 | the server since that timestamp. The XML is validated on the server |
| | 22 | using RELAX-NG before it's sent to the client.</li> |
| | 23 | <li style="margin-bottom: 1em;"> |
| | 24 | <p>Zotero processes the updated object data from the server and compares it to local data:</p> |
| | 25 | <p></p> |
| | 26 | <ol style="list-style-type: lower-alpha;"> |
| | 27 | <li style="margin-top: 1em; margin-bottom: 1em;">If an object has changed only remotely, it is saved/updated/deleted locally.</li> |
| | 28 | <li style="margin-bottom: 1em;">If an object has the same primary id (a small integer) as a local |
| | 29 | object but a different secondary key (a unique string generated at |
| | 30 | object creation time), it is a different object, so the primary id of |
| | 31 | the local version is changed to an available id.</li> |
| | 32 | <li style="margin-bottom: 1em;">If an object has been modified both locally and remotely, Zotero |
| | 33 | displays a conflict resolution window allowing you to choose between |
| | 34 | either version and make manual edits to the merged version.</li> |
| | 35 | </ol> |
| | 36 | </li> |
| | 37 | <li style="margin-bottom: 1em;">Zotero converts updated objects into XML and POSTs to /upload. The |
| | 38 | uploaded XML is validated on the server using RELAX-NG, and the server |
| | 39 | saves the new data, overwriting existing data.</li> |
| | 40 | <li style="margin-bottom: 1em;">Zotero sends an /unlock request to the server, freeing other clients to sync.</li> |
| | 41 | </ol> |
| | 42 | <h2>Additional Details</h2> |
| | 43 | <ul> |
| | 44 | <li>All data is transferred using HTTPS.</li> |
| | 45 | <li>Data is gzipped in both directions to reduce bandwidth and improve sync time.</li> |
| | 46 | </ul> |
| | 47 | |
| | 48 | }}} |