Reputation: 2089
I am currently developing an application using dropbox c# API.
DropBox is able to capture changes on their server and also the changes in their client almost immediately.
What technique they use to synchronize this 2 replicas?
Wish someone can provide me some clue to start with, I try to avoid the timer base synchronization.
Thanks.
Upvotes: 1
Views: 3738
Reputation: 1911
For server side changes you have to request "list_folder_continue" in V2 api. It will return list of changes made. Test it using this link.
Upvotes: 0
Reputation: 911
I don't know what they use. But you can use filesystemwatcher from c#. That will allow you to catch a file change event. It is not the easiest thing to work with, but simple to use.
To make sure that old revisions of the file to not overwrite the new, I guess they use a revision counter, which is often the case.
To identify if the file is changed from the current stored file, I imagine they may use a number of checks
if (local[file.name].size != server[file.name].size)
{
file.changed = true;
}
else if (local[file.name].md5 != server[file.name].md5)
{
file.changed = true;
}
else
{
file.changed = false;
}
Upvotes: 1
Reputation: 65877
For client changes, they might use file system watcher. If there is a change in dropbox folder, they ll trigger the API to update the drop box server.
I am not sure about the server side changes, But there should be some timer mechanism to poll the server to see the changes..
Upvotes: 0