Question

I have been working on a desktop app using AppJS (HTML5, JQUERY). In my application, I ask user to input a folder path of his/her local machine (where application is running) and store that info in my database on the server.

I have to push a file to that folder (on the user's machine) whenever the file gets updated on the server. how can I achieve this? how I can keep client and the server in sync so that server can push that file to local machine.

I have written the scheduler app for the server which will push the file down to client. But, I am not getting how to push that file to specific client. what parameters I need to push the file to client like client's machine MAC Address or something else.

how dropbox does sync?

Please help!!!

Was it helpful?

Solution

If you are able to run nodejs on the server then you can use socket.io to communicate between client and server. Think of it like a chatroom like msn or skype. As users open the appjs application it can connect to the server.

When you have a file to push send a message like "updatedFile" and then list the url. Clients can then download the file and save to the local disk.

This way all connected clients can download updates and no need to poll all of the time - just have websocket open.

When a client connects it could send a message changesSince timestamp and receive a list of all files changed on server since that time which it can then download and save to local disk one by one.

OTHER TIPS

You can try using tools like rsync which can directly help you achieve this. http://en.wikipedia.org/wiki/Rsync

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top